我正在做以下练习:
我的代码:
#include <string>
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
ifstream inFile;
ofstream outFile;
double currentSalary, increaseRate, updatedSalary;
string firstName, lastName;
inFile.open ("Data.txt");
outFile.open("Output.dat");
outFile << fixed << showpoint << setprecision(2);
inFile >> lastName >> firstName;
inFile >> currentSalary >> increaseRate;
updatedSalary = currentSalary * (1 + increaseRate / 100);
outFile << firstName << " " << lastName<< " " << updatedSalary << endl;
inFile >> lastName >> firstName;
inFile >> currentSalary >> increaseRate;
updatedSalary = currentSalary * (1 + increaseRate / 100);
outFile << firstName << " " << lastName<< " " << updatedSalary << endl;
inFile >> lastName >> firstName;
inFile >> currentSalary >> increaseRate;
updatedSalary = currentSalary * (1 + increaseRate / 100);
outFile << firstName << " " << lastName<< " " << updatedSalary << endl;
system("PAUSE");
return 0;
}
但是当我用 MS VS 调试它时,它只是说“按任意键继续......”
在哪里添加 Data.txt 文件?