All Togather

This is a discussion on All Togather within the C++ Programming forums, part of the General Programming Boards category; Hi I am new to C++ again since I left it like 7 months ago. But how do I make ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    14

    All Togather

    Hi I am new to C++ again since I left it like 7 months ago.

    But how do I make this code here.

    Code:
    #include <iostream.h>
    int main()
    {
    	int num;
    	cout<<"Hello please enter your favorite number!";
    	cin>>num;
    	cout<<"So thats your favorite number eh: "<<num;
    	return 0;
    }
    Make it so the press any key to continue be under
    So thats your favorite number eh
    Please help me

    A.S.A.P
    I love programming

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    system("pause");

    and

    #include <cstdlib>

  3. #3
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    I think he's using VC++ since he has the press any key to continue already.

    Try this:
    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
    	int num;
    	cout<<"Hello please enter your favorite number!";
    	cin>>num;
    	cout<<"So thats your favorite number eh: "<<num<<endl;
    	return 0;
    }
    Away.

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    14
    Ok but how does this peiece of code work.

    [ODE]using namespace std;
    <<endl;[/CODE]
    I love programming

  5. #5
    Registered User
    Join Date
    Jan 2003
    Posts
    45
    Or use this
    Code:
    cout<<"So thats your favorite number eh: "<<num<<"\n";

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>press any key to continue
    Read this

    >>using namespace std;
    Read this

    and finally, for <<endl;
    Read this
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

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