•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 391,609 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,625 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 162 | Replies: 3 | Solved
![]() |
•
•
Join Date: Jul 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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?
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?
Last edited by twburkle : Jul 7th, 2008 at 10:35 pm. Reason: Clarification
•
•
Join Date: Jul 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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?
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;
•
•
Join Date: Jan 2008
Posts: 1,403
Reputation:
Rep Power: 6
Solved Threads: 179
•
•
•
•
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.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
- Bouncing ball Program (Java)
- Please steer me in the right direction (Software Developers' Lounge)
- Payroll Program (Java)
- Creating first GUI Java Program (Java)
- Anyone offer any advice with small program... (Java)
- Direction requested (Site Layout and Usability)
- Undergrad Advice (IT Careers and Business)
- My 1st C++ program advice needed (C++)
- Windows NT2000 randomly restarting self (Windows NT / 2000 / XP / 2003)
Other Threads in the C++ Forum
- Previous Thread: vectors question
- Next Thread: PLZ RESPOND...Very very important



thanks
Linear Mode