📄 ifstream.cc
字号:
#include <iostream>
#include <fstream>
using namespace std;
#include <string>
int main()
{
ifstream fin;
fin.open("data");
if(!fin.is_open()){
cout << "open data file error!" << endl;
return -1;
}
string name;
int age;
double weight;
fin >> name >> age >> weight;
fin.close();
cout << "name=" << name << endl;
cout << "age=" << age << endl;
cout << "weight=" << weight << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -