注册 登录
编程论坛 C++教室

怎么运行的结果是乱码啊

mehere 发布于 2008-07-14 18:54, 1326 次点击
程序为
#include<iostream>
using namespace std;
int main()
{int i,a[4]={1,2,3,5};
for(i=0;1<4;i++)
 cout<<a[i]<<" ";
return 0;
}
编译器为dev c++ 4.9.9.2

顺便问一下 运行完后执行文件会自动关闭 除了在末尾加上cin>>a;之类的话外 还有没有其他方法?
9 回复
#2
linren2008-07-14 20:16
#include<iostream>
using namespace std;
int main()
{int i,a[4]={1,2,3,5};
for(i=0;[bo]1[/bo]<4;i++)
cout<<a[i]<<" ";
return 0;
}
#3
漫游者李李西2008-07-14 20:44
加上system(“PAUSE”)。
#4
mehere2008-07-15 14:38
回复 2# linren 的帖子
   眼睛太差了~~  谢谢
回复 3# 漫游者李李西 的帖子
   ...;
   pause;
   return 0;
这样的吗? 编译说是undeclared!
#5
zzc54112008-07-15 15:58
system(“PAUSE”);
#6
mehere2008-07-17 14:09
真的可以
谢谢
这是个函数还是什么?
#7
nwpu0634172008-07-17 15:00
system();
函数调用Dos系统的功能,Pause在Dos中就是停止,等待输入继续的意思
#8
mehere2008-07-18 22:18
非常感谢  又学了一招
#9
aipb20072008-07-18 22:54
system("pause"); 需要头文件cstdlib
getch();    需要头文件conio.h
#10
mehere2008-07-24 22:07
[bo][un]aipb2007[/un] 在 2008-7-18 22:54 的发言:[/bo]

system("pause"); 需要头文件cstdlib

我没用此头文件啊~~
1