system (pause) Error

Hi, when i run my prog. from exe file, it does not stay on screen. I tried system (pause) fun. but code block show an error that " system was not declared in this scope. how to solve it?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    cout << "Please Enter First Digit: ";
    cin >> a;
    cout << "Please Enter Second Digit: ";
    cin >> b;
    cout << endl;

    if (a > b)
    {
        cout << " First Digit is Greater Than Second Digit: \n " <<  a << " > " << b << endl;

    }
    else if (a < b)
    {
        cout << " First Digit is Smaller Than Second Digit: \n " <<  a << " < " << b << endl;
    }
    else
    {
        cout << " First Digit is Equal to Second Digit: \n " <<  a << " = " << b << endl;
    }

    cout << " Have a Nice Day Dear." << endl;

system("pause");


}

Last edited on
Hi better you should use below function instead : system("pause");

1
2
3
#include <conio.h>

getch();


Ya, it worked.
Hi,

Also have a read of the post that is stickied to the top of the beginners forum.

conio.h is not standard, so it is probably a good idea not to use it.

Cheers :+)

Edit:

Using system is not a good idea either. Read up about this on google.
Last edited on
So what should use instead "conio" library?
Try google ncurses
Topic archived. No new replies allowed.