发表时间:2022-03-25来源:网络
经典c程序100例==81--90
【程序81】
题目:809*??=800*??+9*??+1 其中??代表的两位数,8*??的结果为两位数,9*??的结果为3位数。求??代表的两位数,及809*??后的结果。
1.程序分析:
2.程序源代码:
output(long b,long i)
{ printf("n%ld/%ld=809*%ld+%ld",b,i,i,b%i);
}
main()
{long int a,b,i;
a=809;
for(i=10;i=1000&&b
b.x=20;
b.c='y';
}
==============================================================
【程序88】
题目:读取7个数(1—50)的整数值,每读取一个值,程序打印出该值个数的*。
1.程序分析:
2.程序源代码:
main()
{int i,a,n=1;
while(n
i=rand()%100;
printf("nplease input number you guess:n");
start=clock();
a=time(NULL);
scanf("%d",&guess);
while(guess!=i)
{if(guess>i)
{printf("please input a little smaller.n");
scanf("%d",&guess);}
else
{printf("please input a little bigger.n");
scanf("%d",&guess);}
}
end=clock();
b=time(NULL);
printf("1: It took you %6.3f secondsn",var=(double)(end-start)/18.2);
printf("1: it took you %6.3f secondsnn",difftime(b,a));
if(var
gotoxy(3,24);printf(" Tab __browse cost list Esc __quit");
gotoxy(13,10);printf(" ");
gotoxy(13,13);printf(" ");
gotoxy(13,7);printf("%s",chtime);
j=18;
ch[0]=getch();
if(ch[0]==27)
break;
strcpy(chshop,"");
strcpy(chmoney,"");
if(ch[0]==9)
{
mm:i=0;
fp=fopen("home.dat","r+");
gotoxy(3,24);printf(" ");
gotoxy(6,4);printf(" list records ");
gotoxy(1,5);printf("|-------------------------------------|");
gotoxy(41,4);printf(" ");
gotoxy(41,5);printf(" |");
while(fscanf(fp,"%10s%14s%fn",chtime,chshop,&chm)!=EOF)
{ if(i==36)
{ getch();
i=0;}
if ((i%36)16)
{ gotoxy(41,4+i-17);
printf(" ");
gotoxy(42,4+i-17);}
i++;
sum=sum+chm;
printf("%10s %-14s %6.1fn",chtime,chshop,chm);}
gotoxy(1,23);printf("|---------------------------------------------------------------------------|");
gotoxy(1,24);printf("| |");
gotoxy(1,25);printf("|---------------------------------------------------------------------------|");
gotoxy(10,24);printf("total is %8.1f$",sum);
fclose(fp);
gotoxy(49,24);printf("press any key to.....");getch();goto pp;
}
else
{
while(ch[0]!='r')
{ if(j
if(*p1==*p2)
{while(*p1==*p2&&*p2!='0')
{p1++;
p2++;}
}
else
p1++;
if(*p2=='0')
sum++;
p2=str2;
}
printf("%d",sum);
getch();}
==============================================================
【程序97】
题目:从键盘输入一些字符,逐个把它们送到磁盘上去,直到输入一个#为止。
1.程序分析:
2.程序源代码:
#include "stdio.h"
main()
{ FILE *fp;
char ch,filename[10];
scanf("%s",filename);
if((fp=fopen(filename,"w"))==NULL)
{printf("cannot open filen");
exit(0);}
ch=getchar();
ch=getchar();
while(ch!='#')
{fputc(ch,fp);putchar(ch);
ch=getchar();
}
fclose(fp);
}
==============================================================
【程序98】
题目:从键盘输入一个字符串,将小写字母全部转换成大写字母,然后输出到一个磁盘文件“test”中保存。
输入的字符串以!结束。
1.程序分析:
2.程序源代码:
#include "stdio.h"
main()
{FILE *fp;
char str[100],filename[10];
int i=0;
if((fp=fopen("test","w"))==NULL)
{ printf("cannot open the filen");
exit(0);}
printf("please input a string:n");
gets(str);
while(str[i]!='!')
{ if(str[i]>='a'&&str[i]
皓盘云建最新版下载v9.0 安卓版
53.38MB |商务办公
ris云客移动销售系统最新版下载v1.1.25 安卓手机版
42.71M |商务办公
粤语翻译帮app下载v1.1.1 安卓版
60.01MB |生活服务
人生笔记app官方版下载v1.19.4 安卓版
125.88MB |系统工具
萝卜笔记app下载v1.1.6 安卓版
46.29MB |生活服务
贯联商户端app下载v6.1.8 安卓版
12.54MB |商务办公
jotmo笔记app下载v2.30.0 安卓版
50.06MB |系统工具
鑫钜出行共享汽车app下载v1.5.2
44.7M |生活服务