首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

简单的程序实现有关问题

2012-03-07 
简单的程序实现问题 在线等//输出200-300间不能被整除的数//#include iostream.h#include iomanip.hvo

简单的程序实现问题 在线等
//输出200-300间不能被整除的数//
#include <iostream.h>
#include <iomanip.h>

void main()
{
int n;
cout<<"ptess any key to continue. "<<endl;
for(n=200;n<=300;n++)
{if(n%3==0)
continue;
cout<<n<<endl;
}

}
我要是实现
ptess any key to continue.
应加入什么代码??

[解决办法]
system("pause");
[解决办法]
cin();可以不
[解决办法]
int main(int argc, char* argv[])
这个主要是命令行参数问题,是main要从命令行传入参数
第一个argument 是有几个,第2个是 用字符串存的argument.
象在UNIX, $ a.out aFile
a.out就是argv[0], aFile 就是argv[1],而argc=2;
 
[解决办法]

C/C++ code
#include <iostream> #include <iomanip>using namespace std;int main() {     int n;     cout<<"ptess any key to continue.  "<<endl;     for(n = 200; n <= 300; n++)     {        if(n%3 == 0)             continue;         cout<<n<<endl;     }         system("PAUSE");    return 0;} 

热点排行