↑ 收起筛选 ↑
求高手解答C语言程序设计考试题,在线等,急啊!!
2020-07-31

#include <stdio.h>int main(){ char ch=NULL; int big=0,small=0,others=0; while((ch=getchar())!='#') { if(ch>='A'&&ch<='Z') big++; else if(ch>='a'&&ch<='z') small++; else if(ch<'0'||ch>'9') others++; } printf("bigletter=%d\nsmallletter=%d\nothers=%d\n",big,small,others); return 0;}

第一题:#include<stdio.h>int m,n,k;int main(){ m = 3; while(scanf("%d",&n) == 1){ int an = 0; int i; for(i = 2;i <= n;i ++) { k = m%i; an = (an+k)%i; } an += 1; printf("%d\n",an); } return 0;} 第二题#include<stdio.h>#include<string.h> //支持strlen(

#include <stdio.h>void main(){ int a[3][4], b[3][4], c[3][4], i, j; printf("请输入3行4列的矩阵e69da5e887aa7a686964616f31333262383638A:\n"); for(i=0; i<3; i++) for(j=0; j<4; j++) scanf("%d", &a[i][j]); printf("请输入3行4列的矩阵B:\n"); for(i

#include <stdio.h>int main() { int n = 0,ID; int Class1boys = 0,Class1girls = 0; int Class2boys = 0,Class2girls = 0; FILE *fin = fopen("student.dat","rt"); if(fin == NULL) { printf("打开文件出错.\n"); return 1; } while(fscanf(fin,"%d",&ID) == 1)

#include <stdio.h>#include <string.h>#include <stdlib.h>typedef struct node{ char num[10]; int chi,math,sum; struct node *next;}node;void create(node **head);void append(node *head);void traverse(node *head);void delete(node *head,char num[]);

main { int i=0;int a[8];int sum=0;float ave; printf("请输入所有人的升高\n"); for(i=0;i<8;i++){ scanf("%d",&a[i]);}for(i=0;i<8;i++){sum=sum+a[i];}ave=(float)sum/8;printf("平均身高为:\n");printf("%f",ave);}

1) float x, y; scanf("%f", &x); if(x>-5 && x<0) y=x; else if(x==0) y=x-1; else if(x>0 && x<10) y=x+1; else printf("Input wrong!"); printf("y = %.2f\n",y);2) int n=20, i, j, s1=1, s2=0; for(i=1; i<=n; i++){ for(j=1; j<=i; j++) s1=j*s1; s2+=s1; } printf("sum =

#include <Stdio.h>#include <math.h>float fun (float a,char b,float c);float fun (float a,char b,float c){ float g; switch (b) { case '+' :g=a+c;break; case '-' :g=a-c;break; case '*' :g=a*c;break; case '/' :g=a/c;break; default:printf ("输入错误!\n"); } return g

#include<stdio.h>f(char s[],char del) { int i=0; int flag = 0; while(s[i]!='\0') { if (s[i] == del) { if (flag ==0) { printf("\n"); } flag = 1; } else { printf("%c",s[i]); flag = 0; } i++; } printf("\n"); }main(){ char s[100]; char del; printf("input a string:"); gets(s);

1、自己建立一个用于判断天数的子函数,就用if什么的就好,然后返回天数值就行了.2、两个for循环嵌套就好.类似下面这样for(int i=0;i<10;i++){ for(int j=0;j<10;j++) { //比较语句 比如 if(a[i]==b[j]) printf("%d",a[i]); }}

延伸阅读: