I am working on what should probably be a pretty basic coding project, requiring me to write a few functions sending values back to main. I am compiling after completing each one and am stuck on this one because I keep getting a crazy compiler message. Here is the code i have written:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
//this function accepts student records input from the keyboard and saves them in the arrays for student ID, test 1 and test 2
int inputStudentRecords (int stuID [], int test1 [], int test2[], int count)
{
int response = 1;
while (response == 1)
{
cout << "Enter '1' if you have student records to input. Otherwise, enter any other digit. ";
cin >> response >> endl;
if (response == 1)
{
cout << "Enter student ID: ";
cin >> stuID [count] >> endl;
cout << "Enter student's grade for Test 1: ";
cin >> test1 [count] >> endl;
cout << "Enter student's grade for Test 2: ";
cin >> test2 [count] >> endl;
}
count++;
}
return count;
}
|
and here is the error I am getting after using g++:
tests.cpp:77: error: no match for ‘operator>>’ in ‘std::cin.std::basic_istream<_CharT, _Traits>::operator>> [with _CharT = char, _Traits = std::char_traits<char>](((int&)(& response))) >> std::endl’
/usr/include/c++/4.4/istream:119: note: candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>& (*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.4/istream:123:
i am using the library <iostream> before the main function, so i am completely confused why it says there is no match for the in operator. Help is greatly appreciated!!