Problems converting from printf scanf to cin cout

For my homework assignment I have been been asked to take my previous project and change it from using <stdio.h> to <iostream> In the process I've had quite a few errors, and am just a little stuck on a few particular ones.

As far as my preprocessor directives go, I have included:

#include <iostream>
#include <iomanip>
#include <fstream>

the error codes I have gotten specify specific lines of my code. One of the recurring errors I get is:

error: expected primary-expression before âfloatâ

This error came from these lines:

void PrintAverages(ofstream &output, int tot_employees, float tot_payrate, float tot_reghrs,
                   float tot_ovthrs, float tot_gross, float tot_fed, float tot_state,
                   float tot_ssi, float tot_def, float tot_net)

    output << reportfile, "\n\nAverages:" << tot_payrate / tot_employees <<
              tot_reghrs / tot_employees << tot_gross / tot_employees <<
              tot_fed / tot_employees << tot_ssi / tot_employees << tot_net / tot_employees <<
              tot_ovthrs / tot_employees << tot_state / tot_employees << tot_def / tot_employees;

This is one of my external functions. The error code occurs several times with my other functions. I figure that the issue is similar to what ever is causing this one. If anyone could help point me in the right direction that would be great!



What type is reportfile? The comma between reportfile and the \n\nAverages: string looks odd - shouldn't that be a << also?

You'll want spaces between your floats, otherwise it will all run together. Use << " " << between each float instead of just <<.



as ofstream is declared in namespace std.

Also the comma after reportfile should be a <<.

Need Your Help

Error causes password change while updating new data in Yii

database yii passwords

While I'm trying to update the AID field in database with this function:

Google maps is always displayed

php google-maps if-statement

I want to hide the google map if the sql fails: