I am working on a program to get the array.max_size fuction to work right.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include<iostream> //for input/output functions
#include<array>// for array functions
usingnamespace std; //for using standard spaceing output
int main()
{
int input;
cout << "input integer: ";
cin >> input;
int FibinoncciMembers[input];
cout << '\n' << FibinoncciMembers.max_size();
system("PAUSE");
return 0;
}
Everytime I try to compile this code I get
\Users\MyNameHere\Documents\CURRENT\Math\Personal\ArrayGetMaxSize.cpp C:\Users\Adrian\Documents\CURRENT\Math\Personal\C array: No such file or directory.
C:\Users\MyNameHere\Documents\CURRENT\Math\Personal\ArrayGetMaxSize.cpp In function `int main()':
11 C:\Users\MyNameHere\Documents\CURRENT\Math\Personal\ArrayGetMaxSize.cpp request for member `max_size' in `FibinoncciMembers', which is of non-class type `int[((unsigned int)((int)input))]'
Error messages, would some help get this running right plase (fyi, I am using the Dev Bloodshed Compiler)?
The hint is:
\Users\MyNameHere\Documents\CURRENT\Math\Personal\ArrayGetMaxSize.cpp C:\Users\Adrian\Documents\CURRENT\Math\Personal\C array: No such file or directory.
You are including <array> so I guess you want to use std::array instead of a normal array. The size of an std::array has to be known at compile time which is not the case here so std::vector is probably a better choice.