要求键盘输入角度和距离数据
123 30°
123 40°
123 50°
……
然后存入txt文档
距离 角度
123 30°
123 40°
123 50°
……
C++可以吗
#include <fstream>
#include <iostream>
using namespace std;
ofstream of;
string a, b;
int main()
{
of.open("txt.txt");
of << "距离 角度" << endl;
while(cin >> a >> b)
{
of << a << " " << b << endl;
}
of.close();
}