永发信息网

40句 c语言程序设计

答案:4  悬赏:0  手机版
解决时间 2021-03-15 17:00
  • 提问者网友:难遇难求
  • 2021-03-15 00:31
一段40句左右的C语言程序设计编程,不要太复杂有的发到我信箱273860156@qq.com
最佳答案
  • 五星知识达人网友:北城痞子
  • 2021-03-15 01:03

#include"stdio.h"
shuRu(int a[10])
{
int i;
printf("input 10 number:\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
}
jiSuan(int a[10])
{
int i;
int s=0;
for(i=0;i<10;i++)
s+=i;
return s;
}
shuChu(int sum)
{
printf("the sum is : %d\n",sum);
}
main()
{
int a[10],sum=0;
shuRu(a);
sum=jiSuan(a);
shuChu(sum);

}
全部回答
  • 1楼网友:duile
  • 2021-03-15 04:32
#include "stdio.h" #include "graphics.h" main() { int i; printf("\n\n\n\n good !"); getch(); for(;;) { i=menu_select(); switch(i) { case 0: clrscr(); printf("\n\n\n\t\tI love you !");getch(); break; case 1:clrscr(); printf("\n\n\n\t\tyou are right!");getch(); break; case 2:clrscr(); printf("\n\n\n\t\tso good y0ou are!");getch(); case 3:clrscr();clrscr(); printf("\n\n thanks for your used!"); getch(); clrscr();exit(0); } } } menu_select() { int c; clrscr(); do{ printf("\n Enter you choice(0~3):"); scanf("%d",&c); } while(c<0||c>3); return c; }
  • 2楼网友:千杯敬自由
  • 2021-03-15 03:20
#include<stdio.h> #define FALSE 0 #define TRUE 1 int main() { char nextChar; int gotOne = FALSE; int gotTwo = FALSE; int gotThree = FALSE; int gotAt = FALSE; int gotDot = FALSE; printf("Enter your e-mail address:"); do { scanf("%c",&nextChar); if (nextChar>='a' && nextChar<='z') gotOne = TRUE; if (nextChar =='@' && gotOne == TRUE) gotAt = TRUE; if (nextChar>='a' && nextChar<='z' && gotAt == TRUE) gotTwo = TRUE; if (nextChar =='.' && gotTwo == TRUE) gotDot = TRUE; if (nextChar>='a' && nextChar<='z' && gotDot == TRUE) gotThree = TRUE; } while (nextChar !=' ' && nextChar !='\n'); if(gotThree == TRUE) printf("Your e-mail address appears to be valid.\n"); else printf("Your e-mail address is not valid!\n"); } 为什么要40行...随便找了一段,有空数一下吧
  • 3楼网友:长青诗
  • 2021-03-15 01:52

1题

#include<stdio.h> void main() { int a=0, b=0, m=0, n=0; char c; while((c=getchar())!='\n') { if(c>=48&&c<=57) a++; else if((c>=65&&c<=90)||(c>=97&&c<=122)) b++; else if(c==32) m++; else n++; } printf("数字的个数%d 字母的个数%d 空格的个数%d 其他字符的个数%d", a,b,m,n); }

2题

#include<stdio.h> void main() { int a, n, m=0; long k= 0,l=0; scanf("%d %d",&a, &n); while(m<n) { k = a+k; l = k+l; a = a*10; m++; } printf("%ld",l); }

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯