1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#include<iostream>
#include<fstream>
#include<iomanip>
#include <sstream>
using namespace std;
string padLeft(string,char,int);
string padRight(string,char,int);
string fromMoneyToStr(double);
int main()
{
int tax=0;
string item1,item2,item3,item4,item5;
double price1,price2,price3,price4,price5;
char a,b,c,d,e;
string f,g,h,i,j;
ifstream inFile;
inFile.open("input.dat");
if(inFile.fail())
{
cout<<"The file failed to open."<<endl;
return -1;
}
inFile>> tax >> item1 >> price1 >> a >> item2 >> price2 >> b >> item3 >>\
price3 >> c >> item4 >> price4 >> d >> item5 >> price5 >> e;
inFile.close();
f=fromMoneyToStr(price1);
g=fromMoneyToStr(price2);
h=fromMoneyToStr(price3);
i=fromMoneyToStr(price4);
j=fromMoneyToStr(price5);
cout<< f << " " << g << " " << h << " " << i << " " <<j <<endl;
return 0;
}
|