I'm trying to make a program that asks the user if they wish to quit. but Dev-C++ is giving me this error:
27 C:\Dev-Cpp\GradeBook.cpp no match for 'operator>>' in 'std::cin >> q'
here's the code:
Code:
#include <iostream>
#include <string>
using namespace std;
class GradeBook
{
public:
void displayMessage()
{
cout << "Welcome to the Grade Book!" << endl;
}
};
int main()
{
top:
system("CLS");
GradeBook myGradeBook;
myGradeBook.displayMessage();
string q[1000000];
q[0] = "y";
do
{
topOfLoop:
cout << "\nDo you wish to quit? (y/n): ";
cin >> q;
if (q[0] == "n") goto top;
if (q[0] == "y") return 1;
else
cout << "That's not a choice!\n\n";
goto topOfLoop;
}
while (q[0] != "y");
return 0;
}
I recently changed the array to a string array from a char array. The char array worked a little better but I'm trying to improve the program. Any help?