# 实验2

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

#define  N 5
#define R1 586
#define R2 701

int main()
{
int number;
int i;
srand(time(0));
for(i=0;i<N;++i)
{
number=rand()%(R2-R1+1)+R1;
printf("20228330%04d\n",number);
}
system("pause");
return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main()
{
double x,y;

char c1,c2,c3;

int a1,a2,a3;

scanf("%d%d%d",&a1,&a2,&a3);

scanf("%c%c%c",&c1,&c2,&c3);

scanf("%lf%lf",&x,&y);

printf("a1=%d,a2=%d,a3=%d\n",a1,a2,a3);

printf("c1=%c,c2=%c,c3=%c\n",c1,c2,c3);

printf("x=%lf,y=%lf\n",x,y);

system("pause");

return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
double x,ans;

while(scanf("%lf",&x)!=EOF)
{ans=pow(x,365);
printf("%.2f的365次方:%.2f\n",x,ans);
printf("\n");
}

system("pause");

return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main()
{
double F,C;
while(scanf("%lf",&C)!=EOF)
{
F=C*9/5+32;
printf("摄氏度=%.2f\n",C);
printf("华氏度=%.2f\n",F);

}

system("pause");

return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main()
{char m;
while(scanf("%c",&m)!=EOF)
{
getchar();
switch(m)
{case'y':printf("wait a minute\n");
break;
case'g':printf("go go go\n");
break;
case'r':printf("stop!\n");
break;
default:printf("must be wrong\n");
break;
}

}

system("pause");

return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
int i=1;
int number,x;
srand(time(0));
number=rand()%20+1;
printf("猜猜2023年四月哪一天会是你的幸运日");
printf("你有三次机会，猜吧（1~30）");
while(i<4)
{scanf("%d",&x);
if(x>number)printf("猜晚了");
else if(x<number)printf("猜早了");
else if(x=number){printf("猜中了");break;}

i++;}
if(i>3)printf("次数用完了，你的幸运日是%d",number);
system("pause");

return 0;
}

运行截图

#include<stdio.h>#include<stdlib.h>int main()
{int n,m,i,k;
i=1;
k=1;
while(i<=9)
{while(k<=i)
{m=i*k;
printf("%dx%d=%2d  ",k,i,m);
k++;}
printf("\n");
k=1;
i++;}
system("pause");

return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main()
{int i,k,n,m,a,b,x,y,z,t,j,c;
i=1;
t=0;
b=1;
x=0;
y=0;
z=0;
k=1;
n=1;
m=1;
a=1;
c=1;
scanf("%d",&j);
n=2*j-1;
while(b<=n){x=0;
y=0;
z=0;

while(x<t){
printf("\t");x++;}
while(i<=n)
{printf(" o      ");
i++;}printf("\n");
while(y<t){printf("\t");y++;}
while(k<=n){
printf("<H>     ");k++;}
printf("\n");
while(z<t){printf("\t");z++;}
while(a<=n){
printf("I I     ");a++;}
printf("\n");
b++;
t++;
c=c+2;
a=c;
k=c;
i=c;
}
system("pause");

return 0; }

问题

posted @ 2023-03-22 22:33  无良无常  阅读(7)  评论(0编辑  收藏  举报