|
-
Feb 28th, 2013, 11:40 AM
#1
Thread Starter
Junior Member
error c2678:binary'>>':no operator...
i am trying to learn c++. i have a decent understanding of visual basic, and bought a book, c++ primer plus and am trying to complete the exercises, but in chapter 5 i ran into a problem with loops adding user input. it is supposed to take the user input and add each number the user inputs until a 0 is input. the code i have is as follows:
#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: error c2678:binary'>>':no operator found which takes a left-hand operand of type 'std::istream'
cin >> num;
}
cin.get();
return 0;
}
i have used the cin statement and i'm sure this is the way the signs are supposed to point, and i even did std::cin >> "Enter a number "; to see if that was it. any help is appreciated.
Last edited by sfzombie13; Feb 28th, 2013 at 11:50 AM.
Reason: forgot full text of error message
< advertising link removed by moderator >
-
Feb 28th, 2013, 11:55 AM
#2
Thread Starter
Junior Member
Re: error c2678:binary'>>':no operator...
got it, what an idiot mistake. i was using cin instead of cout. sometimes when you get in deep, it's hard to see the easy ones
< advertising link removed by moderator >
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|