主页 > 程序语言 > C语言程序编写

C语言程序编写

2023-11-20 11:09来源:m.sf1369.com作者:宇宇

一、C语言程序编写

main()

{

char str[20];

int i;char c;

printf(input string:);

gets(str);

printf(input n:);

scanf(%d,&i);

if(i-1>=0 && i-1<20)

printf(%c,str[i-1]);

else

printf(input n error.\n);

getch();

}

二、c语言编写程序

13

程序:

#include<stdio.h>

void main(){

 int a[40],i=0,k,v=1;

 while(i<40){

   for(k=0;k<v;k++)

   a[i++]=v;

   v+=2;

 }

 for(i=0;i<40;i++)

 printf(%d ,a[i]);

 getch();

}

三、编写一个c语言程序

不用循环语句做:当你输出不太多的时候^_^

main()

{

printf(*\n);

printf(**\n);

printf(***\n);

printf(**\n);

printf(*\n);

}

第二题:

main()

{

printf(****\n);

printf(****\n);

printf(****\n);

}

for循环的就用楼上的吧,这么简单的问题要自己思考~

四、c语言 编程

#includevoid main() { int a = 3 ,b = 4 , c = 5 ; double d = 1.2 , e = 2.23 , f = 43.56 ; printf(a=%3d, b=%-4d, c=**%d,\n,a,b,c); printf(d=%2.1f\n,d); printf(e=%6.2f\n,e); printf(f=%-9.4f**\n,f); } 我来解释下: %Xd(注X表示数字) 表示用X个格打印出数字 X是正的表示数字靠近右边 负的表示靠近左边 当输出的数的位数大于X 则按照原数输出 %X.Yf(X Y是数字) 表示用X个格打印出数字(小数点也在内) Y表示小数点后的数有Y个 X是正的表示数字靠近右边 负的表示靠近左边 当输出的数的位数大于X 则按照原数输出 不知道解释得好不好

五、c语言编程

花了半宿给你编了,我已经调试到最精简了。我也是刚学的,所以只能到这种水平,希望对你有帮助吧。注释指加了几句必要的,因为只要有一点c基础就能看懂,你就自己加吧!

下面是源代码:

#include main() { int i,k,l,m,n; char j; puts(Please chose your floor No.:); puts(1 2 3 4 5 6 ); scanf(%d,&i); if(i==1) { puts(Please press the up button); printf(%c:s\n,24); } else if(i==6) { puts(Please press the down button); printf(%c:x\n,25); } else { puts(Please chose the up or the down button); printf(%c:s %c:x,24,25); } printf(\n); scanf(%c,&j); printf(%c,j); puts(Please choose which floor you want to go); puts(1 2 3 4 5 6 ); printf(\n); printf(\n); scanf(%d,&k); /* k是要去的楼层 */ printf(\n); printf(\n); printf(\n); if(k==i) puts(This is your floor now you in); else if(k>i) for(l=i+1;l<=k;l++) printf(%d\n,l); else if(k=i;m--) printf(%d\n,m); puts(This is the floor you want to go!); getch(); }

六、Visual C如何编写C语言程序?

满意答案诚敬谦和4级你先熟悉下软件的功能键,visual c 是一边用来编写c++的,,朋友,向你推荐一个很好的C语言程序的编辑软件,,win-tc 你可以用这个变c语言,,加油 补充: 编程者要用最好的软件,,那样可以更好的表达自己的思想,,不过用vc以后学c++就会更简单,,我建议你还是先用win-tc,,以后你就觉得我的建议没错 追问: 用了,每次都要修改原代码,加个getch();挺麻烦,,可以的话介绍一下visual c 的用法,答案就是您了~ 回答: 你用得是一个多功能的软件,不是为了要你那虚有的分数就来回答你的问题,,只是有自己知道的帮助一下,,你可以用里面的vc++,,可以编写C语言程序,,你就先熟悉下,,里面有一个目标程序,,那个打开后就是那你要的软件 追问: 嘻嘻,这我知道,分是没啥用的,可我用visual c 连怎么新建.c文件都不会 (T。T) 回答: 那你可以下点教程,,有中国教程网,,那上面有好多我们要学的东西,,如果你是初学者,,你就用win-tc,,那样对你调试有好处,,如果用vc的话,以后你调试都不知道那里出错了,, 森林狼oοΟ 的感言: 很好,中国教程网我也喜欢。

相关推荐

哪些编程语言是函数式的

程序语言 2024-01-14

VB编程的函数详解

程序语言 2024-01-02

c语言扑克牌问题

程序语言 2023-12-28

iphone语言与地区有什么用?

程序语言 2023-12-19

C语言程序,怎么使用,

程序语言 2023-12-17

把word嵌入到C#程序中

程序语言 2023-11-26

HTML是不是编程语言?

程序语言 2023-11-17