C++ 系统(“暂停”)不可用;即使使用正确的收割台,也不能工作
我在visualstudio中编写这个程序时,需要多次使用system(“pause”),但每当我运行代码时,它都不会暂停。我有C++ 系统(“暂停”)不可用;即使使用正确的收割台,也不能工作,c++,C++,我在visualstudio中编写这个程序时,需要多次使用system(“pause”),但每当我运行代码时,它都不会暂停。我有标题和所有内容。这不起作用还有其他原因吗?谢谢 #include <iostream> #include <ctime> #include <cstdlib> #include <stdlib.h> using namespace std; int main() { int range = (rand() %
标题和所有内容。这不起作用还有其他原因吗?谢谢
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <stdlib.h>
using namespace std;
int main() {
int range = (rand() % 5) + 1;
double start = 0;
double end = 0;
cout << "Try to hit the same key within " << range << "seconds.";
system("pause");
start = clock();
system("pause");
end = clock();
system("pause");
return 0;
}
#包括
#包括
#包括
#包括
使用名称空间std;
int main(){
整数范围=(rand()%5)+1;
双启动=0;
双端=0;
cout这实际上对我来说很好(在Windows上),但是如果你只想读一次击键,那么试试这个(应该在任何地方都可以):
#包括
#包括
#包括
#包括
#包括
使用名称空间std;
int main(){
整数范围=(rand()%5)+1;
双启动=0;
双端=0;
cout“pause”不是一个可以自行运行的程序,它是命令提示符的一个功能。如果必须使用系统调用来执行此操作,请改为运行:
cmd.exe/c暂停
您在哪个操作系统上运行该程序?@πάνταῥεῖ Windows?@PaulSanders从这个问题上你有什么把握?@πάνταῥεῖ Visual Studio?这是大多数人运行它的地方…但我明白你的意思。@Paul还有其他操作系统可以使用VS代码。
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main() {
int range = (rand() % 5) + 1;
double start = 0;
double end = 0;
cout << "Try to hit the same key within " << range << "seconds.";
int c = getc (stdin);
start = clock();
c = getc (stdin);
end = clock();
c = getc (stdin);
return 0;
}