| 查看: 3095 | 回复: 19 | |||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | |||
lirenshun铁虫 (初入文坛)
|
[交流]
一步一步学习C语言 已有4人参与
|
||
|
从今天开始一步步学习C语言,希望自己能够一路坚持,贴出刚学的程序,鼓励自己,加油。 #include "stdio.h" int main(int argc,char* argv[]) { FILE *s,*d; char ch; if(argc!=3) { printf("please input sourcefile and destfile\ } else { if((s=fopen(argv[1],"r" )==0) { printf("can't open file %s\n",argv[1]) } else { if((d=fopen(argv[2],"w" )==0) {printf("can't open file %s\n",argv fclose(s); } else { while((ch=fgetc(s))!=EOF) fputc(ch,d); fclose(s); fclose(d); } } } } |
» 猜你喜欢
售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急
已经有7人回复
现代”学阀”该如何界定
已经有3人回复
售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急
已经有3人回复
国社科系统bug了,是不是要放榜了?
已经有9人回复
申博发邮件
已经有9人回复
各位大神,目前国内有哪些比较好用的逆合成软件?
已经有9人回复
上海工程技术大学激光智能制造课题组|2027级博士研究生招生公告
已经有8人回复
上海工程技术大学激光智能制造课题组招收博士研究生
已经有8人回复
lirenshun
铁虫 (初入文坛)
- 应助: 0 (幼儿园)
- 金币: 394.8
- 帖子: 34
- 在线: 43.1小时
- 虫号: 539592
- 注册: 2008-04-04
- 性别: GG
- 专业: 核技术及其应用
★
jjdg(金币+1): 感谢参与 2012-03-06 02:18:03
jjdg:编辑内容 2012-03-06 02:18
jjdg(金币+1): 感谢参与 2012-03-06 02:18:03
jjdg:编辑内容 2012-03-06 02:18
|
继续贴个程序,求三个正整数最小公倍数。 [#include int main(void) { int x=0,y=0,z=0; int lcm(int a,int b); int lcm3(int a,int b,int c); printf("please input three positive numbers :" ); scanf("%d%d%d",&x,&y,&z); printf("the lcm of the three numbers is:%d\n",lcm3(x,y,z)); return 0; } int lcm3(int a,int b,int c) { return lcm(lcm(a,b),c); } int lcm(int a,int b) { int multiple=0,c=0; multiple=a*b; while(a%b!=0) { c=a%b; a=b; b=c; } return (multiple/b); } ] [ Last edited by jjdg on 2012-3-6 at 02:18 ] |
17楼2012-03-05 20:57:47
lurencyj
木虫 (著名写手)
- 应助: 159 (高中生)
- 金币: 2869.2
- 散金: 520
- 红花: 8
- 沙发: 10
- 帖子: 1244
- 在线: 148.3小时
- 虫号: 888093
- 注册: 2009-10-29
- 性别: GG
- 专业: 凝聚态物性I:结构、力学和

2楼2012-03-02 20:32:58
lurencyj
木虫 (著名写手)
- 应助: 159 (高中生)
- 金币: 2869.2
- 散金: 520
- 红花: 8
- 沙发: 10
- 帖子: 1244
- 在线: 148.3小时
- 虫号: 888093
- 注册: 2009-10-29
- 性别: GG
- 专业: 凝聚态物性I:结构、力学和

3楼2012-03-02 20:39:16
lirenshun
铁虫 (初入文坛)
- 应助: 0 (幼儿园)
- 金币: 394.8
- 帖子: 34
- 在线: 43.1小时
- 虫号: 539592
- 注册: 2008-04-04
- 性别: GG
- 专业: 核技术及其应用
4楼2012-03-02 20:49:21










)==0)
回复此楼
