[ C++] syntax error

Results 1 to 5 of 5
  1. #1
    offonline King Grub is offline
    Grand MasterRank
    Aug 2009 Join Date
    Spring fieldLocation
    3,303Posts

    [ C++] syntax error

    ................................
    Last edited by King Grub; 23-01-11 at 10:03 AM.


  2. #2
    Elite Member Smitty is offline
    Member +Rank
    Nov 2004 Join Date
    Kingston, ONLocation
    150Posts

    Re: [HELP] C++ error

    You're missing the end quote after your newline character, which should actually be \n and not /n.

  3. #3
    offonline King Grub is offline
    Grand MasterRank
    Aug 2009 Join Date
    Spring fieldLocation
    3,303Posts

    Re: [HELP] C++ error

    PHP Code:
    #include <iostream>
    using namespace std;

    int main() {

        
    int ournumber;
        
    cout<<"Enter your number: ";
        
    cin>> ournumber;
        
    cin.ignore();
        
    cout<<" You entered: "<< ournumber <<"\n;
            cin.get();

    Still same error.

  4. #4
    Elite Member Smitty is offline
    Member +Rank
    Nov 2004 Join Date
    Kingston, ONLocation
    150Posts

    Re: [HELP] C++ error

    You're still missing the quote after \n.

    Code:
    cout<<" You entered: "<< ournumber <<"\n;
    should be

    Code:
    cout<<" You entered: "<< ournumber <<"\n";

  5. #5
    offonline King Grub is offline
    Grand MasterRank
    Aug 2009 Join Date
    Spring fieldLocation
    3,303Posts

    Re: [HELP] C++ error

    Quote Originally Posted by Smitty View Post
    You're still missing the quote after \n.

    Code:
    cout<<" You entered: "<< ournumber <<"\n;
    should be

    Code:
    cout<<" You entered: "<< ournumber <<"\n";
    Oh lols sorry im just dumb :p
    Thanks smitty once again.



Advertisement