nonconformed 0 Newbie Poster
// function prototype - print accepted transactions
void transAccepted(ofstream&, int&, string&, int&, float&);

// function prototype -  print rejected transactions
void transRejected(ofstream&, int&, string&, int&, string&);

//function call
transAccepted(outputFile, count, accept, weight, cost);

//function call
transRejected(outputFile, count, reject, weight, fill);

//prototype header
void transAccepted(ofstream &outputFile, int &count, string &accept,
                   int &weight, float &cost)
{
    outputFile << setw(3) << count << setw(16) << accept << setw(10)
               << weight << setw(10) << cost << endl;
    outputFile << count << accept << weight << cost << "\n";
}

void transRejected(ofstream &outputFile, int &count, string &reject,
                   int &weight, string &fill)
{
    outputFile << setw(3) << count << setw(16) << reject << setw(10)
               << weight << setw(10) << fill << endl;;
    outputFile <<"\n" << count << reject << weight << fill << "\n";
}

*** Output sample
1 Accepted 1 1.50
1Accepted11.50
2 Accepted 7 9.90
2Accepted79.90
3 Accepted 21 31.90
3Accepted2131.90

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.