lzth.net
当前位置:首页 >> 【C语言】化学狗误入此课...一道编程题...求大佬帮... >>

【C语言】化学狗误入此课...一道编程题...求大佬帮...

#includeint main(void){printf("%s\n","你是一条傻狗");return 0;}

#include <stdio.h>#define N 15int fun(int a[]){int i,j,k,m=N;for(i=0;i<m-1;i++)for(j=i+1;j<m;j++)if(a[j]==a[i]){for(k=j;k<m-1;k++)a[k]=a[k+1];m--;i--;}return m;}void main(){int i,k,a[N];for(i=0;i<N;i++){scanf("%d",&a[i]);if(a[i]<=0){printf("输入的第%d个数

#include<stdio.h>void fun1(char*p){char *q; for(q=p;*q=='*';q++); for(;*p++=*q++;);}void fun2(char*p){char *q; for(q=p;*q;q++); for(;*--q=='*';); *++q='\0';}int main(){char s[100]="******1234jshd sfg jg**ksj **** shdfhks4321******"; puts(s); fun1(s); fun2(s); puts(s); return 0;}

#include int main(){int n,i,j,s=0; struct stud{ char id[10]; char name[10]; int score; }stu[10]; scanf("%d",&n); for(i=j=0;istu[j].score)j=i; } printf("The average score=%.2f\n",(float)s/n); printf("The student who has the highest score is:%s %s %d",stu[j].id,stu[j].name,stu[j].score); return 0;}

#include <stdio.h>int main(){int k;scanf("%d",&k);while(k--){int p[10];int q,w,e,r=0,t;scanf("%d %d %d",&q,&w,&e);//q为 考试科目数 w为平均分 e为单科分数线t=q;while(q--){scanf("%d",&p[r]);r++;}//循环结束后 r为考试科目数.int lx=0;while(

#include typedef struct nono{ char num[6]; char name[8]; int score_1; int score_2; int score_3; int score_4;} N1;void input(N1 *le){ for (int i = 0; i { scanf("%s%s%d%d%d%d", le[i].num, le[i].name, &le[i].score_1,\ &le[i].score_2, &le[i].score_3, &le[i].

int main() { int h1,h2,m1,m2; printf("Input time one(hour,minute):"); scanf("%d,%d",&h1,&m1); printf("Input time two(hour,minute):"); scanf("%d,%d",&h2,&m2); int s1,s2; s1=h1*60+m1; s2=h2*60+m2; int d=abs(s1-s2); printf("%d hour %d minutes",d/60,d%60); return 0; }

#include <stdio.h>int main() { char src[64*1024], pass[256]; scanf("%s", src); scanf("%s", pass); int i=0, j=0; while(src[i] != '\0') { if(pass[j] == '\0') j=0; src[i] = src[i]+pass[j]; i++; j++; } printf("%s", src); return 0;}

思路是这样的,m为结果的高位,n为结果的低位,如果n共有x位,则结果为高位乘10的x次方加低位,写成代码为:#include<stdio.h>#include<math.h>int main(){ int m,n,result; scanf("%d%d",&m,&n); //计算n的位数 count int x = n; int count=0; while(x !=0){ x /= 10; count++; } //结果=m*10的count次方+n result = m * pow(10,count) + n; printf("%d",result);}

#include<stdio.h>void dec2n(int x,int n){if(x>=n)dec2n(x/n,n);printf("%ld",x%n); }int main(){int x;long int n=2,m=8;scanf("%d",&x);printf("%d的%d进制为:\n",x,n); dec2n(x,n);printf("\n"); printf("%d的%d进制为:\n",x,m); dec2n(x,m);printf("\n"); return 0;}

相关文档
网站首页 | 网站地图
All rights reserved Powered by www.lzth.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com