文件操作
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream fin("in.txt");
char c;
fin>>c;
cout<<c;
fin.close();
return 0;
}
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
freopen("in.txt","r",stdin);
char c;
cin>>c;
cout<<c;
fclose(stdin);
return 0;
}
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
FILE * fin;
fin=fopen("in.txt","rb");
//fin=stdin;
char c;
fscanf(fin,"%c",&c);
cout<<c;
fclose(stdin);
return 0;
}
STL库
string
find
https://www.cnblogs.com/wkfvawl/p/9429128.html
s.find(str);返回第一个起始下标
s.rfind(str);从右边找,返回右边第一个子串位置的起始下标
s.find_first_of(str);返回第一个起始下标
s.find_last_of(str);返回最后一个子串的末尾字符下标