Getline()

closed account (LE3bqMoL)
Where and how would I put a getline(), since the name is a string???

#include<iomanip>
#include<iostream>
#include<fstream>
using namespace std;

int main ()
{
int customernumber,totalcustomers;
string customername;
double benningbalance,creditcardcharges,amountpaid,financecharges,currentbalance;
ifstream infile;
ofstream outfile;
infile.open("customer.dat");
infile>>totalcustomers;
outfile.open("summary.dat");
infile>>customernumber;
infile>>customername;
infile>>beginningbalance;
infile>>creditcardcharges;
infile>>amountpaid;
infile>>financecharges;
cout<<"Customer Number";
cout<<" Customer Name";
cout<<" Beginning Balance";
cout<<" Credit Card Charges";
cout<<" Finance Charges";
cout<<" Amount Paids"<<endl;
cout<<setiosflags(ios::fixed|ios::showpoint)<<setprecision(2);
currentbalance=beginningbalance+creditcardcharges-amountpaid+financecharges;
while(!infile.eof())
{
cout<<customernumber;
cout<<setw(20)<<customername;
cout<<setw(20)<<beginningbalance;
cout<<setw(20)<<creditcardcharges;
cout<<setw(25)<<financecharges;
cout<<setw(25)<<amountpaid<<endl;
cout<<"Current Balance "<<currentbalance<<endl;
infile>>customernumber;
infile>>customername;
infile>>beginningbalance;
infile>>creditcardcharges;
infile>>amountpaid;
infile>>financecharges;
outfile<<customernumber;
outfile<< customername;
outfile<< currentbalance<<endl;
}
cout<<"Total Customers "<<totalcustomers<<endl;
infile.close();
outfile.close();
return 0;
Last edited on
getline(cin,customername);

please use [code][/code] tags when posting code
closed account (LE3bqMoL)
Can someone help please???
Last edited on
The question makes no sense. Edit the post, add tags, and ask a question that makes sense.
Topic archived. No new replies allowed.