I want to know how to get the length of a long long
. I have a simple function where I am trying to get the length of a long long
and I also get an error.
while (numberArray[i].length() > MAX_INPUT)
{
cout << "ERROR: Program can only take in a number length " << MAX_INPUT << " or less. Try again ->";
cin >> numberArray[i];
}
NOTE: numberArray
is a static that was made an int
. The call to .length()
worked perfectly but I wanted to change the type to long long
and now .length()
does not seem to work anymore.
This is the type of message I get from the compiler every time I try and run the code:
In function 'void takeNumbers(std::__cxx11::string&, long long int (&)[11], int)': main.cpp:48:26: error: request for member 'length' in 'numberArray[i]', which is of non-class type 'long long int' while (numberArray[i].length() > MAX_INPUT){