i am trying to learn c++ from a book, c++ primer plus, and visual studio 2010. i am stuck on an exercise in chapter 5 where i am suppposed to use a loop to take user input and keep a running sum until the user enters a 0. the code i have so far is:
#include <iostream>
int main()
{
using namespace std;
int num;
int total = 0;
int x;
cout << "Enter number: ";
cin >> num;
while (num != 0) { total = total + num;
cout << total << endl;
cin >> "Enter a number "; //this is where the error is
cin >> num;
}
cin.get();
return 0;
}
the full text of the error message is: error c2678:binary'>>':no operator found which takes a left-hand operand of type 'std::istream' . and one more thing i was wondering, is there a difference between c++ and visual c++? any help is appreciated.