• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help with one thing in c++

Elaney

Member
Joined
Jan 1, 2009
Messages
1,561
Reaction score
12
Location
Sweden
Well im trying to learn on my own. But i got 1 tiny problem. I think it's becuse im using the forgotten rev that causing it. But when i trie to make something, when i push enter it just disapear. here is code

Code:
//ett första exempel
#include <iostream>
using namespace std ;

int main()
{
          int tal1, tal2, tal3;
          cout << "mata in 3 tal:";
          cin >> tal1 >> tal2 >> tal3;
          int summa = tal1 + tal2 + tal3;
          cout << "summan av talen blir" << summa;
          cin.get();
          return 0;
}
 
It's because the code has no pause. I don't remember what function it was, try these(It's probably not one of them, been a long time since I used C++ :p):

pause();
stop();
wait();
 
Use code::blocks instead :)

Anyway, this will pause for a keypress, enough for you to see the message atleast.

Code:
//ett första exempel
#include <iostream>
using namespace std ;

int main()
{
          int tal1, tal2, tal3;
          cout << "mata in 3 tal:";
          cin >> tal1 >> tal2 >> tal3;
          int summa = tal1 + tal2 + tal3;
          cout << "summan av talen blir\n" << summa;
          return system("PAUSE");
}
 
Back
Top