please provide pseudo code for this.
while(!fin.eof())
{
numPeople++;
getline(fin,name); // READ name
name = name.substr(0,name.length()-1); // REMOVE ‘n’ from theend of name
// READ id and balance
fin>>id>>balance;
totalBalance += balance; // DETERMINE the smallBalance
if(smallName.length()==0)
{
smallName = name;
smallId = id;
largeId = id;
smallBalance = balance;
largeBalance = balance;
}
else
{
if(balance < smallBalance)
{
smallBalance = balance;
smallName = name;
smallId = id;
}
if(balance > largeBalance)
{
largeBalance = balance;
largeName = name;
largeId = id;
}
}
fout<<left<<setw(10)<<id<<left<<setw(20)<<name<<left<<setw(6)<<“$”<<left<<setw(1)<<fixed<<setprecision(2)<<balance<<endl;
fin.ignore(std::numeric_limits<std::streamsize>::max(),’n’);//cin leaves n in the input so remove it
}
Expert Answer
An answer will be send to you shortly. . . . .