homework 11 2016 5 13 读入文件做输入
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
string x, y, z;
cin >> x >> y >> z;
ifstream file1(x.c_str());
ifstream file2(y.c_str());
ofstream file3(z.c_str());
string a, b;
getline(file1,a);
getline(file2,b);
int aa=a.length();
int bb=b.length();
cout<<"length of file1:"<<aa<<endl<<"length of file2:"<<bb<<endl;
if(aa>=bb){
aa=bb;
}
bool flag = true;
for(int i=0;i<aa;i++){
if(a[i]!=b[i]){
cout<<"file1:";
cout<<a<<endl;
cout<<"file2:";
cout<<b<<endl;
file3 << "Different " << i << endl;
cout << "Different " << i << endl;
flag = false;
break;
}
}
if(flag){
cout<<"file1:";
cout<<a<<endl;
cout<<"file2:";
cout<<b<<endl;
file3 << "Same " << aa << endl;
cout << "Same" << aa << endl;
}
file1.close();
file2.close();
file3.close();
}
最新文章
- centos下建立双机信任关系
- Zookeeper概论(对zookeeper的概论、原理、架构等的理解)
- C# 换行符
- Mysql-通过case..when实现oracle decode()函数进行多值多结果判断
- linux 使用 pyodbc 访问 ms sqlserver 数据库
- 用Delphi实现文件关联
- json-lib-2.4.jar Bug,json字符串中value为";[value]";结构时,解析为数组,不会解析成字符串
- 【UVA 10816】 Travel in Desert (最小瓶颈树+最短路)
- writev/readv
- Hibernate 查询:HQL查询(Hibernate Query Languge)
- TDD(测试驱动开发)学习一:初识TDD
- bitset基础用法+心得
- win10 删除设备和驱动器中你不要的图标
- STL -->; list用法
- ueditor图片无法左右对齐的解决
- Libgdx1.6.2发布,跨平台游戏开发框架
- WITH RECOMPILE和OPTION(RECOMPILE)区别
- 【转发】Cookie存储的值大小限制和个数问题
- 5.JVM的内存区域划分
- django的数据库操作