自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 C++对文件同时读写的实验//用dvc 00001.dvc

第5次实验题目-1文件“round1.exe”文件请进行如下变换:1、读取文件内容0-125000到字符串s1(共125001个字符)2、读取文件剩余内容到字符串s2(共n-125001个字符)3、字符串s=s2+s14、在s中搜寻“18606311394”,替换为“18606310394”5、将s串写入文件6、运行变换后的文件,有惊喜!#include<iostream&gt...

2019-04-15 23:07:20 584

原创 C++字符串查找

1、学生成绩数据库,每名同学有三项数据:学号、姓名、成绩,放在一个字符串中。以两名同学的数据为例,串的内容为:"=001-Wang-95=002-li-98="要求,从键盘输入某同学的学号,通过对字符串的处理,分割出该同学的三项数据并且分行输出。注意:学号、姓名、成绩的长度都是不固定的,禁止手工操作!#include<iostream>#include<string>...

2019-04-15 22:35:15 888

原创 C++二进制文件同时读写

#include<iostream>#include<string>#include<fstream>using namespace std;class File{private: fstream f; string s;public: File() { f.open("001.txt",ios::binary|ios::in|ios:...

2019-04-08 22:56:38 780

原创 C++二进制文件写,读操作,在文件后面追加字符串

写二进制文件#include<iostream>#include<string>#include<fstream>using namespace std;class File{private: ofstream f; string s;public: File() { f.open("002.dat",i...

2019-04-08 22:14:08 1783

原创 C++将文本文件转化为单串并查询

#include<iostream>#include<string>#include<fstream>using namespace std;class Dict{private: ifstream f1; ofstream f2; string s,temp,word;public: Dict() { f1.ope...

2019-04-08 18:31:58 83

原创 C++把一串字符串中的偶数位和奇数位取出来分别组成两个子串

#include <iostream>#include <string>using namespace std;int main(){ string s="a1b2c3d4e5f6g7h8i9j0"; string s1,s2; for(int i=0;i<s.size();++i) { if(i%2==0)...

2019-04-05 22:40:47 4019

原创 C++读写文件,查找英汉词典(注意英汉词典文件要放在程序文件夹下)

#include <iostream>#include<string>#include<fstream>//文件操作头文件using namespace std;int main(){ string s1="line 1",s3; string s2="line 2",s4; //------------------- ...

2019-04-01 21:27:29 1019

原创 C++进行算式解析,如计算“1+2” “6*2”,解析字符串之去空格

计算“1+2”#include <iostream>#include<cstdlib>#include<string>#include<sstream>//需要添加字符串using namespace std;int str2num(string s)//使字符串转化为数字{ int n; stringstream ss...

2019-04-01 19:54:53 1111

原创 C++字符串倒序,查找子串,连接字符串,取子串,替换子串,删除字串

字符串倒序#include <iostream>#include<cstdlib>#include<string>using namespace std;int main(){ string s="abcde",temp; temp=s;//注意要设置一个字符串变量承接倒序后的字符串,而且要对字符串进行初始化,把S赋值给temp ...

2019-04-01 19:30:16 2797

原创 C++字符串字母大小写转换,字符串偏移(最简单的加密方式)加密与解密

#include <iostream>#include<cstdlib>#include<string>using namespace std;int main(){ string s="abceFd"; for(int i = 0 ;i < s.size();++i) { if(s[i]>='A'&...

2019-04-01 16:28:38 3538

原创 C++查找字符的Ascii码,注意和查找键盘的Ascii码相区别

#include <iostream>#include<cstdlib>#include<string>using namespace std;int main(){ cout<<(int)'A'<<endl;//65 cout<<(int)'a'<<endl;//97 retur...

2019-04-01 16:19:27 1001

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除