أختي انا جذي سويته جوفي بعد
--------------------------------------------------------------------------------
# include <iostream>
# include <iomanip>
# include <string>
# include <fstream>
using namespace std;
void main ()
{
ofstream outfile;
ifstream infile;
string item;
float price;
outfile.open ("invoicel.txt");
infile.open ("invoicel.txt");
outfile<<fixed<<showpoint<<setprecision(2);
cout<<fixed<<showpoint<<setprecision(2);
cout<<"Please scan the name of the first item: ";
cin>>item;
if (item!="999")
{
outfile<<item<<" ";
cout<<"Please scan the price of the "<<item<<": ";
cin>>price;
outfile<<price<<endl;
cout<<"\n \n";
while (item!="999")
{
cout<<"Please scan the name of the nixt item: ";
cin>>item;
if (item!="999")
{
outfile<<item<<" ";
cout<<"Please scan the price of the "<<item<<": ";
cin>>price;
outfile<<price<<endl;
cout<<"\n \n";
}
}
}
cout<<"Thank you for your order."<<endl;
cout<<"invoicel.txt"<<endl;
while (infile)
{
infile>>item>>price;
cout<<item<<"#"<<price<<endl;
}
outfile.close ();
infile.close ();
}