www.ypnh.net > 大一C语言必背编程题

大一C语言必背编程题

第一题:#include "stdio.h" void main() { int a,b,sum=0; for(a=0;a main() { char a; int b,c,d,e; b=0;c=0;d=0;e=0; /* b是字母 c是数字 d是符号 e是空格*/ fflush(stdin); printf(

/* 1. */ #include #include char* ReadFile(const char* psz) { FILE* fp = fopen(psz, "r"); if( NULL == fp ) return NULL; fseek(fp, 0, SEEK_END); int nLen = ftell(fp); char* pszBuff = (char*)malloc(nLen + 1); fseek(fp, 0, SEEK_SET); int nSize = fread(

int a;double b,c,d;b=pow(a/100,3); //百位c=pow(a/10%10,3); //十位d=pow(a%10,3);//个位

#include<stdio.h>typedef struct student{ int Grade; int Count; }HIS; void print(int n){ while(n--){ printf("★ "); } } void main(){ HIS gra[40]; int n=0; while(n<40){ printf("请输入第%d个学生的打分(1~10分):",n+1); gra[n].Grade=n+1; scanf(

#include <stdio.h>int main(){int n,a,b,c;scanf("%d",&n);if(n<100||n>999)printf("Input error!");else{a=n/100;b=n/10%10;c=n%10;printf("%d",a*a*a+b*b*b+c*c*c);}return 0;}

#include <stdio.h>#define N 4int main(void){ int a[N][N]; int he=0,ji=1,mx,px=0,py=0,i,j; printf("Please input array(%d * %d:\n",N,N); for(i=0;i<N;i++) for (j=0;j<N;j++) { scanf("%d",&a[i][j]); } mx=a[0][0]; for (i=0;i<N;i++) { for (j=0;j<N;j++) { if (i==j||(i+j+1)

#include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX 255int main(void){ int n; int m; int i = 0; char str_2[MAX]; char *str_1; for(;;) { memset(str_2,MAX,0); scanf("%d",&n); str_1 = (char *)malloc((n + 1) * sizeof(char)); scanf("%s",

#include <stdio.h> int main(){ double data[4][5]; double average[4]; for(int i=0;i<4;i++) for(int j=0;j<5;j++) scanf("%lf",&data[i][j]); //C++: cin >> data[i][j]; for(int i=0;i<4;i++){ for(int j=0;j<5;j++) average[i]+=data[i][j]; average[i]/=5; } for(int i=0;i<4

1. 042. &a[i](i+1)%4==0..printf("\n");3. i==j||(i+j)==2a[i][j]4.100105.str[0]..s..(这题少了个空吧?)三、1.#include <stdio.h>void main(){ int max,min,a[20],i; for(i=0;i<20;i++) scanf("%d",&a[i]); max=min=a[0]; for(i=1;i<20;i++

第一题: int main(){ for (int i = 200; i <= 400; i ++) if (i%2 == 0) printf("%d ", i); return 0;} 第二题: int main(){ int a, b; scanf("%d %d", &a, &b); if (a >= b) printf("%d", a); else printf("%d", b); return 0;} 第三题: int main(){ int a; printf("

网站地图

All rights reserved Powered by www.ypnh.net

copyright ©right 2010-2021。
www.ypnh.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com