Kod: Zaznacz cały
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string firstName, secondName;
double salary, increase , updatedSalary;
cout<<"Processing data..."<<endl;
ifstream infile;
ofstream outfile;
infile.open("E:\visual studio 2010 Projects\Ch3_Ex8Data.txt");
infile>> firstName >> secondName >> salary >>increase;
infile.close();
outfile.open("E:\visual studio 2010 Projects\Ch3_Ex8Output.txt");
outfile<<fixed<<showpoint<<setprecision(2);
updatedSalary=salary+salary*increase/100.0;
outfile<< firstName <<" "<< secondName <<" "<< updatedSalary;
cout<<endl;
cout<< firstName <<" "<< secondName <<" "<< updatedSalary<<endl;
outfile.close();
cout<<"Complete :)"<<endl;
system("Pause");
return 0;
}
, gdzie podane są kolejno: nazwisko , imię, pierwotne wynagrodzenie oraz procentowa podwyżka. Po uruchomieniu programu w pliku Ch3_Ex8Output.txt ma być : Nazwisko, imię oraz wynagrodzenie po podwyżce. W moim programie zamiast tego jestMiller Andrew 65789.87 5
. Najgorsze jest to, że za Chiny nie mogę znaleźć błędu .0.00
PS. Użyłem Visual studio