欢迎来到天天文库
浏览记录
ID:55136109
大小:938.00 KB
页数:44页
时间:2020-04-28
《程序设计基础实验报告汇总.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、《程序设计基础课程设计》实验报告班级:姓名:洪礼翔学号:所选题目:1_1,1_2,2_4,3_2,3_4,4_2,5_1程序设计语言:c++程序设计平台:visualc++6.0日期:2014-4-5签名:第1_1题算法描述:比较两个文本文件并打印出它们第一个不相同的行(文件每行字符数不多于80)。源程序:no1_1.cpp#include#include#include#includevoidmain(){fstreaminfile1,infile2;infile1.open("f1.
2、txt",ios::in);infile2.open("f2.txt",ios::in);if(!infile1){cout<<"f1.txtcan'topen";abort();}if(!infile2){cout<<"f2.txtcan'topen";abort();}chars1[80],s2[80];while(!infile1.eof()&&!infile2.eof()){infile1.getline(s1,sizeof(s1));infile2.getline(s2,sizeof(s2));if(strcmp(s1,s2)){cout<3、out<#include#include#includeintcmp(constvoid*m,constvoid*n);voidmain(){fstreaminf14、,inf2,outf;inf1.open("num1.txt",ios::in);if(!inf1){cout<<"num1.txtcan'topen.";abort();}inf2.open("num2.txt",ios::in);if(!inf2){cout<<"num2.txtcan'topen.";abort();}outf.open("num3.txt",ios::out);if(!outf){cout<<"num3.txtcan'topen.";abort();}intarray[40]={0};inti=0;while(!inf1.eof()){5、inf1>>array[i++];}while(!inf2.eof()){inf2>>array[i++];}qsort(array,i,sizeof(int),cmp);intj(0);while(i){outf<6、.txt。命令行格式:XMLtoTXTemail.xmlemail.txt。源程序:No2_4.cpp#include#include#include#includevoidmain(){fstreaminfile,outfile;infile.open("email.xml",ios::in);if(!infile){cout<<"email.xmlcan'topen.";abort();}outfile.open("email.txt",ios::out);if(!outfile7、){cout<<"email.txtcan'topen.";abort();}charch=0;intstate=0;cout<<"Progressing......"<';i++){str[i]=infile.get();}if(!strcmp(str,"from"))state=-1;if(state==-1&&!strcmp(str,
3、out<#include#include#includeintcmp(constvoid*m,constvoid*n);voidmain(){fstreaminf1
4、,inf2,outf;inf1.open("num1.txt",ios::in);if(!inf1){cout<<"num1.txtcan'topen.";abort();}inf2.open("num2.txt",ios::in);if(!inf2){cout<<"num2.txtcan'topen.";abort();}outf.open("num3.txt",ios::out);if(!outf){cout<<"num3.txtcan'topen.";abort();}intarray[40]={0};inti=0;while(!inf1.eof()){
5、inf1>>array[i++];}while(!inf2.eof()){inf2>>array[i++];}qsort(array,i,sizeof(int),cmp);intj(0);while(i){outf<6、.txt。命令行格式:XMLtoTXTemail.xmlemail.txt。源程序:No2_4.cpp#include#include#include#includevoidmain(){fstreaminfile,outfile;infile.open("email.xml",ios::in);if(!infile){cout<<"email.xmlcan'topen.";abort();}outfile.open("email.txt",ios::out);if(!outfile7、){cout<<"email.txtcan'topen.";abort();}charch=0;intstate=0;cout<<"Progressing......"<';i++){str[i]=infile.get();}if(!strcmp(str,"from"))state=-1;if(state==-1&&!strcmp(str,
6、.txt。命令行格式:XMLtoTXTemail.xmlemail.txt。源程序:No2_4.cpp#include#include#include#includevoidmain(){fstreaminfile,outfile;infile.open("email.xml",ios::in);if(!infile){cout<<"email.xmlcan'topen.";abort();}outfile.open("email.txt",ios::out);if(!outfile
7、){cout<<"email.txtcan'topen.";abort();}charch=0;intstate=0;cout<<"Progressing......"<';i++){str[i]=infile.get();}if(!strcmp(str,"from"))state=-1;if(state==-1&&!strcmp(str,
此文档下载收益归作者所有