⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 经典c程序100例==91--100.htm

📁 C经典算法包含了C经典算法100个程序,资料中的内容是以网页形式保存的.很好的东西
💻 HTM
📖 第 1 页 / 共 3 页
字号:
                              |");<BR>gotoxy(1,18);printf("| | 
                              |");<BR>gotoxy(1,19);printf("| | 
                              |");<BR>gotoxy(1,20);printf("| | 
                              |");<BR>gotoxy(1,21);printf("| | 
                              |");<BR>gotoxy(1,22);printf("| | 
                              |");<BR>gotoxy(1,23);printf("|---------------------------------------------------------------------------|");<BR>i=0;<BR>getdate(&amp;d);<BR>sprintf(chtime,"%4d.%02d.%02d",d.da_year,d.da_mon,d.da_day);<BR>for(;;)<BR>{<BR>gotoxy(3,24);printf(" 
                              Tab __browse cost list Esc 
                              __quit");<BR>gotoxy(13,10);printf(" 
                              ");<BR>gotoxy(13,13);printf(" 
                              ");<BR>gotoxy(13,7);printf("%s",chtime);<BR>j=18;<BR>ch[0]=getch();<BR>if(ch[0]==27)<BR>break;<BR>strcpy(chshop,"");<BR>strcpy(chmoney,"");<BR>if(ch[0]==9)<BR>{<BR>mm:i=0;<BR>fp=fopen("home.dat","r+");<BR>gotoxy(3,24);printf(" 
                              ");<BR>gotoxy(6,4);printf(" list records 
                              ");<BR>gotoxy(1,5);printf("|-------------------------------------|");<BR>gotoxy(41,4);printf(" 
                              ");<BR>gotoxy(41,5);printf(" 
                              |");<BR>while(fscanf(fp,"%10s%14s%f\n",chtime,chshop,&amp;chm)!=EOF)<BR>{ 
                              if(i==36)<BR>{ getch();<BR>i=0;}<BR>if 
                              ((i%36)&lt;17)<BR>{ gotoxy(4,6+i);<BR>printf(" 
                              ");<BR>gotoxy(4,6+i);}<BR>else<BR>if((i%36)&gt;16)<BR>{ 
                              gotoxy(41,4+i-17);<BR>printf(" 
                              ");<BR>gotoxy(42,4+i-17);}<BR>i++;<BR>sum=sum+chm;<BR>printf("%10s 
                              %-14s 
                              %6.1f\n",chtime,chshop,chm);}<BR>gotoxy(1,23);printf("|---------------------------------------------------------------------------|");<BR>gotoxy(1,24);printf("| 
                              |");<BR>gotoxy(1,25);printf("|---------------------------------------------------------------------------|");<BR>gotoxy(10,24);printf("total 
                              is 
                              %8.1f$",sum);<BR>fclose(fp);<BR>gotoxy(49,24);printf("press 
                              any key to.....");getch();goto 
                              pp;<BR>}<BR>else<BR>{<BR>while(ch[0]!='\r')<BR>{ 
                              if(j&lt;10)<BR>{ 
                              strncat(chtime,ch,1);<BR>j++;}<BR>if(ch[0]==8)<BR>{<BR>len=strlen(chtime)-1;<BR>if(j&gt;15)<BR>{ 
                              len=len+1; 
                              j=11;}<BR>strcpy(ch1,"");<BR>j=j-2;<BR>strncat(ch1,chtime,len);<BR>strcpy(chtime,"");<BR>strncat(chtime,ch1,len-1);<BR>gotoxy(13,7);printf(" 
                              ");}<BR>gotoxy(13,7);printf("%s",chtime);ch[0]=getch();<BR>if(ch[0]==9)<BR>goto 
                              mm;<BR>if(ch[0]==27)<BR>exit(1);<BR>}<BR>gotoxy(3,24);printf(" 
                              ");<BR>gotoxy(13,10);<BR>j=0;<BR>ch[0]=getch();<BR>while(ch[0]!='\r')<BR>{ 
                              if (j&lt;14)<BR>{ 
                              strncat(chshop,ch,1);<BR>j++;}<BR>if(ch[0]==8)<BR>{ 
                              len=strlen(chshop)-1;<BR>strcpy(ch1,"");<BR>j=j-2;<BR>strncat(ch1,chshop,len);<BR>strcpy(chshop,"");<BR>strncat(chshop,ch1,len-1);<BR>gotoxy(13,10);printf(" 
                              ");}<BR>gotoxy(13,10);printf("%s",chshop);ch[0]=getch();}<BR>gotoxy(13,13);<BR>j=0;<BR>ch[0]=getch();<BR>while(ch[0]!='\r')<BR>{ 
                              if (j&lt;6)<BR>{ 
                              strncat(chmoney,ch,1);<BR>j++;}<BR>if(ch[0]==8)<BR>{ 
                              len=strlen(chmoney)-1;<BR>strcpy(ch1,"");<BR>j=j-2;<BR>strncat(ch1,chmoney,len);<BR>strcpy(chmoney,"");<BR>strncat(chmoney,ch1,len-1);<BR>gotoxy(13,13);printf(" 
                              ");}<BR>gotoxy(13,13);printf("%s",chmoney);ch[0]=getch();}<BR>if((strlen(chshop)==0)||(strlen(chmoney)==0))<BR>continue;<BR>if((fp=fopen("home.dat","a+"))!=NULL);<BR>fprintf(fp,"%10s%14s%6s",chtime,chshop,chmoney);<BR>fputc('\n',fp);<BR>fclose(fp);<BR>i++;<BR>gotoxy(41,5+i);<BR>printf("%10s 
                              %-14s %-6s",chtime,chshop,chmoney);<BR>}}} 
                              <BR>==============================================================<BR><FONT 
                              color=#990000>【程序96】</FONT><BR>题目:计算字符串中子串出现的次数<BR>1.程序分析:<BR>2.程序源代码:<BR>#include 
                              "string.h"<BR>#include "stdio.h"<BR>main()<BR>{ 
                              char str1[20],str2[20],*p1,*p2;<BR>int 
                              sum=0;<BR>printf("please input two 
                              strings\n");<BR>scanf("%s%s",str1,str2);<BR>p1=str1;p2=str2;<BR>while(*p1!='\0')<BR>{<BR>if(*p1==*p2)<BR>{while(*p1==*p2&amp;&amp;*p2!='\0')<BR>{p1++;<BR>p2++;}<BR>}<BR>else<BR>p1++;<BR>if(*p2=='\0')<BR>sum++;<BR>p2=str2;<BR>}<BR>printf("%d",sum);<BR>getch();} 
                              <BR>==============================================================<BR><FONT 
                              color=#990000>【程序97】</FONT><BR>题目:从键盘输入一些字符,逐个把它们送到磁盘上去,直到输入一个#为止。<BR>1.程序分析:     <BR>2.程序源代码:<BR>#include 
                              "stdio.h"<BR>main()<BR>{ FILE *fp;<BR>char 
                              ch,filename[10];<BR>scanf("%s",filename);<BR>if((fp=fopen(filename,"w"))==NULL)<BR>{printf("cannot 
                              open 
                              file\n");<BR>exit(0);}<BR>ch=getchar();<BR>ch=getchar();<BR>while(ch!='#')<BR>{fputc(ch,fp);putchar(ch);<BR>ch=getchar();<BR>}<BR>fclose(fp);<BR>}<BR>==============================================================<BR><FONT 
                              color=#990000>【程序98】</FONT><BR>题目:从键盘输入一个字符串,将小写字母全部转换成大写字母,然后输出到一个磁盘文件“test”中保存。<BR>   输入的字符串以!结束。 
                              <BR>1.程序分析:<BR>2.程序源代码:<BR>#include 
                              "stdio.h"<BR>main()<BR>{FILE *fp;<BR>char 
                              str[100],filename[10];<BR>int 
                              i=0;<BR>if((fp=fopen("test","w"))==NULL)<BR>{ 
                              printf("cannot open the 
                              file\n");<BR>exit(0);}<BR>printf("please input a 
                              string:\n");<BR>gets(str);<BR>while(str[i]!='!')<BR>{ 
                              if(str[i]&gt;='a'&amp;&amp;str[i]&lt;='z')<BR>str[i]=str[i]-32;<BR>fputc(str[i],fp);<BR>i++;}<BR>fclose(fp);<BR>fp=fopen("test","r");<BR>fgets(str,strlen(str)+1,fp);<BR>printf("%s\n",str);<BR>fclose(fp);<BR>}<BR>==============================================================<BR><FONT 
                              color=#990000>【程序99】</FONT><BR>题目:有两个磁盘文件A和B,各存放一行字母,要求把这两个文件中的信息合并(按字母顺序排列), 
                              <BR>   输出到一个新文件C中。<BR>1.程序分析:<BR>2.程序源代码:<BR>#include 
                              "stdio.h"<BR>main()<BR>{ FILE *fp;<BR>int 
                              i,j,n,ni;<BR>char 
                              c[160],t,ch;<BR>if((fp=fopen("A","r"))==NULL)<BR>{printf("file 
                              A cannot be opened\n");<BR>exit(0);}<BR>printf("\n 
                              A contents are 
                              :\n");<BR>for(i=0;(ch=fgetc(fp))!=EOF;i++)<BR>{c[i]=ch;<BR>putchar(c[i]);<BR>}<BR>fclose(fp);<BR>ni=i;<BR>if((fp=fopen("B","r"))==NULL)<BR>{printf("file 
                              B cannot be opened\n");<BR>exit(0);}<BR>printf("\n 
                              B contents are 
                              :\n");<BR>for(i=0;(ch=fgetc(fp))!=EOF;i++)<BR>{c[i]=ch;<BR>putchar(c[i]);<BR>}<BR>fclose(fp);<BR>n=i;<BR>for(i=0;i&lt;n;i++)<BR>for(j=i+1;j&lt;n;j++)<BR>if(c[i]&gt;c[j])<BR>{t=c[i];c[i]=c[j];c[j]=t;}<BR>printf("\n 
                              C file 
                              is:\n");<BR>fp=fopen("C","w");<BR>for(i=0;i&lt;n;i++)<BR>{ 
                              putc(c[i],fp);<BR>putchar(c[i]);<BR>}<BR>fclose(fp);<BR>}<BR>==============================================================<BR><FONT 
                              color=#990000>【程序100】</FONT><BR>题目:有五个学生,每个学生有3门课的成绩,从键盘输入以上数据(包括学生号,姓名,三门课成绩),计算出<BR>   平均成绩,况原有的数据和计算出的平均分数存放在磁盘文件"stud"中。<BR>1.程序分析:<BR>2.程序源代码:<BR>#include 
                              "stdio.h"<BR>struct student<BR>{ char 
                              num[6];<BR>char name[8];<BR>int score[3];<BR>float 
                              avr;<BR>} stu[5];<BR>main()<BR>{int 
                              i,j,sum;<BR>FILE 
                              *fp;<BR>/*input*/<BR>for(i=0;i&lt;5;i++)<BR>{ 
                              printf("\n please input No. %d 
                              score:\n",i);<BR>printf("stuNo:");<BR>scanf("%s",stu[i].num);<BR>printf("name:");<BR>scanf("%s",stu[i].name);<BR>sum=0;<BR>for(j=0;j&lt;3;j++)<BR>{ 
                              printf("score 
                              %d.",j+1);<BR>scanf("%d",&amp;stu[i].score[j]);<BR>sum+=stu[i].score[j];<BR>}<BR>stu[i].avr=sum/3.0;<BR>}<BR>fp=fopen("stud","w");<BR>for(i=0;i&lt;5;i++)<BR>if(fwrite(&amp;stu[i],sizeof(struct 
                              student),1,fp)!=1)<BR>printf("file write 
                              error\n");<BR>fclose(fp);<BR>}</P>
                              <P></P>
                              <P></P></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
                  <TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=0 
                  width=650 align=center bgColor=#d7ebff border=0>
                    <TBODY>
                    <TR vAlign=center align=middle bgColor=#3986ef>
                      <TD id=notice vAlign=center align=left colSpan=2 
                        height=25>&nbsp;&nbsp;<FONT 
                        color=#ffffff><B>[</B>来源<B>]</B>: beck&nbsp;&nbsp;&nbsp; 
                        <B>[</B>编辑<B>]</B>: <FONT color=#ffffff>beck 
                        </FONT>&nbsp;&nbsp;&nbsp;<B>[</B>加入时间<B>]</B>:2002-8-11 
                        </FONT></TD></TR></TBODY></TABLE><BR><BR>
                  <TABLE width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD>
                        <LI><FONT color=#0772b1>上篇文章</FONT>:<A 
                        href="http://www.vcok.com/class/list.asp?id=211">经典c程序100例==81--90 
                        </A>
                        <LI><FONT color=#0772b1>下篇文章</FONT>:<A 
                        href="http://www.vcok.com/class/list.asp?id=213">Tc2.0编写俄罗斯方块游戏</A> 
                        </LI></TD>
                      <TD align=right>
                        <SCRIPT language=JavaScript>
var onecount;
onecount=0;
subcat = new Array();
        
subcat[0] = new Array("C语言教程","8","35");
        
subcat[1] = new Array("C技术文章","8","36");
        
subcat[2] = new Array("C试题库","8","37");
        
subcat[3] = new Array("C程序百例","8","38");
        
subcat[4] = new Array("C函数库","8","39");
        
subcat[5] = new Array("数据结构教程","9","40");
        
subcat[6] = new Array("常用算法","9","41");
        
subcat[7] = new Array("在线测试","8","42");
        
subcat[8] = new Array("linux入门级","10","43");
        
onecount=9;

function changelocation(locationid)
    {
    document.myform.Nclassid.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</SCRIPT>

                        <FORM name=myform action=ru_query.asp method=post>文章搜索: 
                        <SELECT size=1 name=action> <OPTION value=title 
                          selected>按文章标题搜索</OPTION> <OPTION 
                          value=writer>按文章来源搜索</OPTION> <OPTION 
                          value=content>按文章内容搜索</OPTION> <OPTION 
                          value=Nkey>按照关键词搜索</OPTION></SELECT> <SELECT 
                        onchange=changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value) 
                        size=1 name=classid> <OPTION value="" 
                          selected>请指定范围</OPTION> <OPTION value=8>C语言教室</OPTION> 
                          <OPTION value=9>数据结构</OPTION> <OPTION 
                          value=10>Linux初探</OPTION></SELECT> <SELECT 
                          name=Nclassid> <OPTION value="" 
                          selected>请指定范围</OPTION> <OPTION value=8>C语言教程</OPTION> 
                          <OPTION value=8>C技术文章</OPTION> <OPTION 
                          value=8>C试题库</OPTION> <OPTION value=8>C程序百例</OPTION> 
                          <OPTION value=8>C函数库</OPTION> <OPTION 
                          value=9>数据结构教程</OPTION> <OPTION value=9>常用算法</OPTION> 
                          <OPTION value=8>在线测试</OPTION> <OPTION 
                          value=10>linux入门级</OPTION></SELECT> <INPUT maxLength=50 
                        size=10 value=输入关键字 name=keyword> <INPUT type=submit value=搜索 name=Submit> 
                    </FORM></TD></TR></TBODY></TABLE></TD></TR>
              <TR>
                <TD width="50%" bgColor=#e6e6e6>□- C程序百例热点文章</TD>
                <TD width="50%" bgColor=#e6e6e6>□- 相关文章</TD></TR>
              <TR>
                <TD vAlign=top width="50%" bgColor=#ffffff>1.<A 
                  title=经典c程序100例==91--100 
                  href="http://www.vcok.com/class/list.asp?id=212" target=_top> 
                  经典c程序100例==91--100 </A>[阅读:<FONT 
                  color=red>54282</FONT>]<BR>2.<A title=经典c程序100例==1--10 
                  href="http://www.vcok.com/class/list.asp?id=203" target=_top> 
                  经典c程序100例==1--10 </A>[阅读:<FONT color=red>35287</FONT>]<BR>3.<A 
                  title=经典c程序100例==51--60 
                  href="http://www.vcok.com/class/list.asp?id=208" target=_top> 
                  经典c程序100例==51--60 </A>[阅读:<FONT 
                  color=red>26796</FONT>]<BR>4.<A title="经典c程序100例==11--20 " 
                  href="http://www.vcok.com/class/list.asp?id=204" target=_top> 
                  经典c程序100例==11--20 </A>[阅读:<FONT 
                  color=red>25227</FONT>]<BR>5.<A title="经典c程序100例==81--90 " 
                  href="http://www.vcok.com/class/list.asp?id=211" target=_top> 
                  经典c程序100例==81--90 </A>[阅读:<FONT color=red>23815</FONT>]<BR></TD>
                <TD vAlign=top width="50%" bgColor=#ffffff><A 
                  href="http://www.vcok.com/class/list.asp?id=212">经典c程序100例==91--100</A><BR><A 
                  href="http://www.vcok.com/class/list.asp?id=211">经典c程序100例==81--90 
                  </A><BR><A 
                  href="http://www.vcok.com/class/list.asp?id=210">经典c程序100例==71--80</A><BR><A 
                  href="http://www.vcok.com/class/list.asp?id=209">经典c程序100例==61--70</A><BR><A 
                  href="http://www.vcok.com/class/list.asp?id=208">经典c程序100例==51--60</A><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <DIV></DIV>
      <TABLE width=778 bgColor=#ffffff border=0>
        <TBODY>
        <TR bgColor=#ffffff>
          <TD colSpan=3></TD></TR>
        <TR vAlign=baseline>
          <TD colSpan=3>
            <HR noShade SIZE=1>
          </TD></TR>
        <TR>
          <TD width="7%">&nbsp;</TD>
          <TD width="87%">
            <DIV align=center>唯C世界|<FONT 
            face="Arial, Helvetica, sans-serif">http://wWw.VcOk.Com</FONT>   <FONT 
            face="Arial, Helvetica, sans-serif">Ver 1.00 Design By <FONT 
            face="Verdana, Arial, Helvetica, sans-serif"><B><FONT 
            color=#ff0000><A href="http://www.vcok.com/"><FONT 
            color=#ff0009>VcOk.com</FONT></A></FONT></B></FONT></FONT></FONT></DIV></TD>
          <TD width="6%">&nbsp;</TD></TR>
        <TR>
          <TD width="7%">&nbsp;</TD>
          <TD width="87%">
            <DIV align=center><FONT 
            face="Arial, Helvetica, sans-serif">CopyRight <FONT 
            color=#ff0000>&copy;</FONT> .:.:.:2002-2008 AT Tie Ling Liaoning 
            China:.:.:.</FONT></DIV></TD>
          <TD width="6%">&nbsp;</TD></TR>
        <TR>
          <TD width="7%">&nbsp;</TD>
          <TD align=middle width="87%">&nbsp;&nbsp;&nbsp;&nbsp;辽宁省铁岭师专微机室 
            <U>杨志锋</U> 数学系 <U>杜博</U> &nbsp;&nbsp;&nbsp;&nbsp;</TD>
          <TD width="6%">&nbsp;</TD></TR></TBODY></TABLE></TR></TBODY></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -