My program currently takes three inputs from the user ( Wage, Hours, Tips ), then it calculates the gross income. Im brushing up on my c++ and Im not sure what functions I need to look for, but I know what I want to do.

1. I would like to take multiple wage/tip/hour inputs and calculate one big gross income from previous gross income inputs.
Q: Would multiple arrays let me do that?

Here is some of my code at the moment. After narrowing some google searches, Array's look like should be able to accomplish what I need.

1. Can I assign an Array's element to one gross income, then use a loop to assign the next one? If so, is it as simple as array[1]=salary.calculateIncome or something around there?

cout << "Enter Name:";
        getline (cin,  name );

        cout << "Enter Wage ( per hour ):";
        cin >> wage;

        cout << "Enter Hours Worked:";
        cin >> time;

        cout << "Enter Tips:";
        cin >> tips;

        broSalary.setName( name );
        broSalary.setWage( wage );
        broSalary.setTime( time );
        broSalary.setTips( tips );

        cout << "Income:" << broSalary.calculateIncome() << endl;

Here is some of my code at the moment. After narrowing some google searches, Array's look like should be able to accomplish what I need.

1. Can I assign an Array's element to one gross income, then use a loop to assign the next one? If so, is it as simple as array[1]=salary.calculateIncome or something around there?

cout << "Enter Name:";
        getline (cin,  name );

        cout << "Enter Wage ( per hour ):";
        cin >> wage;

        cout << "Enter Hours Worked:";
        cin >> time;

        cout << "Enter Tips:";
        cin >> tips;

        broSalary.setName( name );
        broSalary.setWage( wage );
        broSalary.setTime( time );
        broSalary.setTips( tips );

        cout << "Income:" << broSalary.calculateIncome() << endl;

There are lots of ways to do what you are trying to do. Arrays are one. Vectors are another. It's hard to comment with this little code. Clearly you are writing a class somewhere and broSalary's type is that class. You haven't posted the code where broSalary is declared and you haven't posted the class, so I can't really comment further. Please post the whole program including any class implementation and header code.

ah ok, well if I can do it with arrays thats awesome, Ive messed around with those before, not vectors though =/, you kinda hit my answer right on the dot :D thanks

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.