| 221.216.254.* |
1楼 #include <stdio.h> int main(void) { printf("hello, world!\n"); return 0; } |
|
|
|
2楼 int main(void) { printf("hello, world!\n"); system("PAUSE");//or getch(); return 0; } |
|
|
|
| 221.216.254.* |
3楼 |
|
|
| 221.216.254.* |
5楼 c:\docume~1\pandora\桌面\untitl~1.cpp: In function `int main()': c:\docume~1\pandora\桌面\untitl~1.cpp:6: implicit declaration of function `int system(...)' 我用的是Dev-c++不知道是不是它的问题 |
|
|
|
6楼 奇怪,我用的也是DEVCPP,怎么没这个问题? 看来你建立的是CPP文件,呵呵,那就难怪了。 再加一行: #include <stdlib.h> |
|
|
|
| 221.216.254.* |
7楼 #include<iostream> int main() { char quit; while (quit != 'q') { cout<<"Hello ! lion.a merry christmas to you"<<endl; cin>>quit; } return 0; } 为什么这个就可以显示出来. 谢谢,我这个人就是这样,不明白的一定要搞明白才行,要不回睡不着觉的,希望大侠们不要看不起我,呵呵,谁叫我刚学呢,在这里先谢谢大家了 |
|
|
|
8楼 system函数和getch函数的作用,请查函数手册。为什么要include <stdlib.h>,这个在你查system等函数的时候,手册会告诉你的。 |
|
|
|
| 219.131.210.* |
12楼 |
|
|
| 61.150.43.* |
13楼 getch函数是要求输入一个字符,你没有输入之前,当然不能一闪而过了 其实getch本来不是干这个的 |
|
|
| 222.93.140.* |
14楼 |
|
|
|
15楼 |
|
|
|
|
16楼 #include<iostream> #include<string> using namespace std; int main() { string name; cout<<"what is your name?"<<endl; cin>>name; cout<<"Hello! "<<name<<endl; getchar(); getchar(); } 最后要用两个 getchanr(); 才能不让显示运行结果的那个窗口关掉. 一个就够麻烦了 还要输两个,再换个程序不知道又要几个getchar()了; 谁有解决这个问题的方法? 在C++吧里没人回答我,所以。。。。 |
|
|
|
| 218.58.249.* |
17楼 |
|
|
| 222.52.40.* |
18楼 void main { int max(int x, int y, int z); int a,b,c,d; scanf("%d,%d,%d",&a,&b,&c); d=max(a,b,c); printf("max=%d\n",d); } int max(int x,int y,int z); { int s; if(x>y)s=x; else s=y; int t; if(s>z) t=s; else t=z; return(t); } 比较三个数的大小,我这样写对吗?我这没有C++的软件无法验证。帮个忙好吗?肖肖 |
|
|
| 218.64.17.* |
19楼 # include <stdio.h> /*文件头部*/ int max(int x,int y,int z); /*x,y,z为形参*/ {int t, /*t为临时变量*/ if (x<y) {t=x;x=y;y=t;} if (x<z) {t=x;x=z;z=t;} /*此时x为最大值*/ return(x); /*返回x的值给函数max*/ } void main {int a,b,c,max; /*a,b,c,max为实参*/ scanf("Input a,b,c:%d,%d,%d",&a,&b,&c);/*输入数据*/ max=max(a,b,c); /*调用max函数*/ printf("max=%d\n",max); /*输出结果*/ } |
|
|
| 218.64.17.* |
20楼 写的不好 请高手指教 qq282765676加时注明 |
|
|
|
23楼 |
|
|
|
| 125.108.33.* |
24楼 |
|
|
|
26楼 |
|
|
|
| 222.216.21.* |
28楼 main() { printf("hello, world!\n"); getch(); } |
|
|
