Function call not working

I'm trying to call this function that will ask for the user input and return it back to the main() into the variables I've set so they can be used later

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int player_stats(int pts, int ass, int stls, int blks, int reb, int turn)
{
        cout << "Enter player's points: ";
        cin >> pts;
        cout << "Enter player's assists: ";
        cin >> ass;
        cout << "Enter player's steals: ";
        cin >> stls;
        cout << "Enter player's blocks: ";
        cin >> blks;
        cout << "Enter player's rebound: ";
        cin >> reb;
        cout << "Enter player's turnovers: ";
        cin >> turn;
        return pts, ass, stls, blks, reb, turn;
}



1
2
3
4
5
6
7
8
9
10
11
12
main()
cout << "Enter user1's players' stats" << endl << endl;                
         cout << "Point Guard Stats:" << endl << endl;
         player_stats(pg_pts, pg_ass, pg_stls, pg_blks, pg_rebs, pg_turn);
         cout << endl << "Shooting Guard Stats:" << endl << endl;
         player_stats(sg_pts, sg_ass, sg_stls, sg_blks, sg_rebs, sg_turn);
         cout << endl <<  "Small Forward Stats:" << endl << endl;
         player_stats(sf_pts, sf_ass, sf_stls, sf_blks, sf_rebs, sf_turn);
         cout << endl <<  "Power Forward Stats:" << endl << endl;
         player_stats(pf_pts, pf_ass, pf_stls, pf_blks, pf_rebs, pf_turn);
         cout << endl <<  "Center Stats:" << endl << endl;
         player_stats(c_pts, c_ass, c_stls, c_blks, c_rebs, c_turn);
anybody?
Hi :-)

a function in C/C++ can't return more than one value (Lua can). Create a struct and use it as a parameter/return value for your function player_stats:

typedef struct {

int pts;
int ass;
int stls;
int blks;
int reb;
int turn;

}sParam;

sParam & player_stats ( sParam & )

or

sParam & player_stats ( void )
Topic archived. No new replies allowed.