1.直接调用系统函数 system("pause");

例如:

#include<iostream>
using namespace std;
int main()
{
   system("pause");
   return 0;
}

2.调用getch()函数:需要include<conio.h>

例如:

#include<conio.h>
int main()
{
   prinf("按任意键继续\n");
    getch();
    return 0;
}

3.调用getchar()函数:需要include<stdio.h>

例如:

#include<stdio.h>
int main()
{
Enter
   getchar();
   return 0;
}

4.使用cin的get()函数

例如:

#include<iostream>
using namespace std;
int main()
{
Enter
   cin.get();
   return 0;
}

注意:只有前两种可以真正实现“按任意键继续”,后两种必需按下Enter键才行。