error message: no match for'operator>>' in 'std::cin >> ISBN'
my code is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>;
usingnamespace std;
int main()
{ double ISBN[9];
int sum=0, subsum=0; // initialize
char c; // save the check digit
cout << "Enter 9-digit book number: "<<endl;
cin >> ISBN;
for (int i = 0; i < 8; ++i)
{
sum = sum + ISBN [i] * (i + 1);
}
cout << sum << endl;
}
If you want to read a number for every element of an array, use a loop. Though then you'd have to enter the digits separated with spaces. The better way would be to read a string (array of 10 chars. 9+1 for the \0). Then convert them from ASCII symbols to their integer values (subtract '0' from each of them).