Can't cout an array
Jan 13, 2019 at 10:11am UTC
Hi I've made the array cs1 to be equal to array cs.
But I cant get the output. The compiler tells that there is a problem at this line: cout << cs; So what is the problem? Thank you!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <array>
using namespace std;
int main()
{
int j;
array<double ,4> cs1 = { 0.1, 0.1, 0.4, 0.2 };
array<double , 4> cs;
cin >> j;
if (j == 1) {
cs=cs1;
};
cout << cs;
system("pause\n" );
return 0;
}
Jan 13, 2019 at 12:23pm UTC
There is no overloads of operator << for std::array.
If you want to print an array you need to write the code for how you want that to be done.
Topic archived. No new replies allowed.