验证性实验
基础练习
#include#include using namespace std;int main(){ ofstream a("3.txt",ios_base::app); if(!"3.txt") { cout<<"fail to open"<
实验三1
#include#include #include #include #include #include "utils.h"using namespace std;typedef struct tongxue{ int xvhao; string xuehao; string xingming; string banji;};int main() { string b; ifstream a; if(!a) { cout<<"faile to open"< >b; a.open(b); int c,i; cout<<"输入随机抽点人数"; cin>>c; cout<<"随机抽点中..."< >shu[i].xvhao>>shu[i].xuehao>>shu[i].xingming>>shu[i].banji; string filename; filename = getCurrentDate()+".txt"; ofstream aa; if(!aa) { cout<<"fail to open"<
没有进行重复清理,然后也只能服务于这一个文本。
实验三2
#include#include #include using namespace std;int main(){ ifstream fin; string wenjian; char zi; int i=0,j=0,k=0; int a,b,c; cout<<"输入要统计的英文文本文件名:"; cin>>wenjian; fin.open(wenjian); if(!fin){ cout<<"sorry"<
我是先计算出行数,然后用行数的几个string类型做的。
开始时候没有计算空格在计算字符数的时候。