Thread: hey guys, need some help with a compile error

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    12

    hey guys, need some help with a compile error

    well this is my first post, and anyway

    i started programming in c++ a few months ago never got very far, and ive taken it up again

    and im compiling one of my practice programs
    and i get errors, btw im using g++ for my linux machine



    Code:
    #include <iostream>
    #include <stdlib.h>
    #include <string>
    using namespace std;
    int main(int argc, char *argv[])
    {
    int i;
    cin > i;
    if (i > 10) {
      cout << "The number is greater than 10" << endl;
    }
    else if (i == 10) {
      cout << "It is equal to 10" << endl;
    }
    else {
      cout << "It is less than 10" << endl;
    }
    return 0;
    }



    and now the error


    gateway C++ # g++ secondprog.cpp -o secondprog
    secondprog.cpp: In function `int main(int, char**)':
    secondprog.cpp:8: no match for `std::istream& > int&' operator


    thanks, and now im gunna go read my c++ for dummies eheh

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    it should be: cin >> i; not cin > i;

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    12
    doh! thanks man ill try that out

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    12
    yeah that worked, i cant believe i overlooked something so obvious :/


    thanks alot!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM
  3. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM