Error message C2676

This is a discussion on Error message C2676 within the C++ Programming forums, part of the General Programming Boards category; I am trying to write a small, simple program for a class that I am taking. I keep getting this ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    14

    Error message C2676

    I am trying to write a small, simple program for a class that I am taking. I keep getting this error code: " error C2676: binary '>>' : 'class std::basic_ostream<char,struct std::char_traits<char> >' does not define this opera
    tor or a conversion to a type acceptable to the predefined operator "

    I do not understand what this means.

  2. #2
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    provide some code?
    My Website
    010000110010101100101011
    Add Color To Your Code!

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    14
    Code:
    // Lab Exercise 1
    // Sum, Average, Max and Min
    // By Sue Claycamp
    #include <iostream>
    
    using std::cout;   // Program uses cout
    using std::cin;     // Program uses cin
    using std::endl;   // Program uses endl
    
    int main( )  // main begins program execution
    {
    	int number1;   // first number input by user
    	int number2;   // second number input by user
    	int number3;   // third number input by user
    	int sum;          // sum of number1, number2, number3
    	int smallest;    // smallest number input by user
    	int largest;      // largest number input by user
    
    	cout >> "Enter three numbers ";
    	cin >> number1 >> number2 >> number3;
    
    	sum = number1+ number2+ number3;
    	cout << "Sum " << endl;
    
    	largest = number1;
    	if (number2 > number1)
    	cout << number2 << "Largest " << endl;
    
    	if (number3 > number1)
    	cout << number3 << "Largest " << endl;
    
    	smallest = number1;
    	if (number2 < number1)
    	cout << number2 << "Smallest " << endl;
    
    	if (number3 < number1)
    	cout << number3 << "Smallest " << endl;
    
    	return 0;   // indicate that program ended successfully
    
    }   // end main

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Code:
    cout >> "Enter three numbers ";
    To:

    Code:
    cout << "Enter three numbers ";

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    14
    Thank you Tonto. Such a simple solution. I have looked at and re-written this program a dozen times today and never noticed that I was putting the symbol in the wrong way.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    Think of it as putting the string into cout, or the screen.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21