为什么编辑的程序运行时不能运行

来源:百度知道 编辑:UC知道 时间:2024/06/01 03:37:33
#include<iostream>
int main()
{
int x=5;
int y=7;
std::cout << "\n";
std::cout << x+y << "" << x*y;
std::cout << "\n";
return 0;
}
我编译过后运行,电脑屏幕闪了下就没有反应了
我编译到现在所有的程序 都这样,请问这是为什么

改了结果还是一样,编译没有任何问题,因为他也生成程序了。就是运行程序除了屏幕闪了下就没有任何反应了 我用的是Dev-c++5编译软件
加了显示错误d:\我的文档\桌面\练习1.cpp: In function `int main()':

d:\我的文档\桌面\练习1.cpp:9: error: stray '\163' in program
d:\我的文档\桌面\练习1.cpp:9: error: stray '\187' in program
d:\我的文档\桌面\练习1.cpp:9: error: expected `;' before "return"

执行结束
PS:怎么样添加头文件

#include<iostream>
int main()
#include<>
{
int x=5;
int y=7;
std::cout << "\n";
std::cout << x+y << "" << x*y;
std::cout

在return前面 加上getchar();

让程序暂停一下就可以看到结果了哦
注意包含相应的头文件哦
你的原因不是是程序问题,你用vc的编译器或g++肯定不会有问题的哦

vc6.0上可以运行啊,结果:1235
不是程序的问题。
要不你改成:
#include<iostream.h>
int main()
{
int x=5;
int y=7;
cout << "\n";
cout << x+y << "" << x*y;
cout << "\n";
return 0;
}