473,583 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

one dimensionl array using array counter

2 New Member
I'm having ALOT of trouble understanding this (C++)..and i don't think i'm even close to getting this right. Please help. The problem reads as follows:

Use a one dimensional array to solve. A company pays on a commission basis. the salespeople receive $200 per week plus 9 percent of their gross sales for that week. (salesperson grosses 5000 in a week receives 200 plus 9 percent of 5000, total of 650) Write a program, using an array of counters, that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is truncated to an integer amount)
a) $200-299
b)$300-399
c)$400-499
d)$500-599
e)$600-699
f)700-799
g)800-899
h)$900-999
i)$1000 and over

this is what i have so far:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;

#include <iomanip>
using std::setw;
int main()
{
const int frequencySize = 11;
int frequency[ frequencySize ] = {};
int grossSales;
int total;





{

cout << "Enter employees gross sales: ";
cin >> grossSales;
cout << "Salary: " << grossSales * .09 + 200;





cout << "\nSalary:" << endl;}



for ( int count = 2; count < frequencySize; count++ )
{
if ( count == 2 )
cout << "$200-299: ";
else if ( count == 1000 )
cout << " $1000 ";
else
cout << "$" << count * 100 << "-" << ( count * 100 ) + 99 << ": ";



for ( int stars = 0; stars < frequency[ count ]; stars++ )
cout << '*';

cout << endl;

}



return 0;

}
Dec 6 '07 #1
1 2222
oler1s
671 Recognized Expert Contributor
Fix your code so it is in CODE tags. These are the forum guidelines, and they exist because we can't read non-formatted code.

So, what's the question? Posting a bunch of code here is nice, and it helps to know the assignment you are working on. But that isn't a question. You need to describe to us what trouble you faced, and what question you have arising from it.
Dec 6 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
839
by: Mendhak [MVP] | last post by:
Possibly because you've called one variable "waveform" and the other "waveforms"? -Mendhak >-----Original Message----- >I have problems due to array using the by ref values >
1
1885
by: osamutoglu | last post by:
Platform is VS.NET 2003 and i am trying to design an application with Forms What is wrong here i didnt get it.. is there something i am missing? .. .. ../** STRUCTURE PROTOTYPE **/ struct task_node { int task_id;
4
3223
by: ayman723 | last post by:
hi, I'm trying to write a program in wich I would generate 20 sentences out of 4 arrays(articles,nouns,preposition,verb).I have to select an item at random from each array and concatetane each one of those selections to form a sentence, I have to form 20 sentences. I have no compiling errors but when I execute the program is giving an...
0
2720
by: k1ckthem1dget | last post by:
I need to display the unsorted list of names and display the sorted list of names. My program is getting a bunch of errors though, and i dont know why. I am getting the following errors. 28: error: cannot convert `char (*)' to `int*' for argument `1' to `void showArray(int*, int)' 33: error: expected unqualified-id before "for" 33:...
2
3238
by: k1ckthem1dget | last post by:
I need to display the unsorted list of names and display the sorted list of names. My program is getting a bunch of errors though, and i dont know why. I am getting the following errors. 28: error: cannot convert `char (*)' to `int*' for argument `1' to `void showArray(int*, int)' 33: error: expected unqualified-id before "for" 33:...
23
7383
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion....
0
5565
by: raypjr | last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the particular elements in the List Box. Any suggestions on how to best write this? ' I create a Structure with members ' place, title, author,...
2
1997
by: raypjr | last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the particular elements in the List Box. Any suggestions on how to best write this? ' I create a Structure with members ' place, title, author, publisher,...
4
1544
Sheepman
by: Sheepman | last post by:
Could someone please walk me through the following program. It's only 15 lines. My comments and questions are below dealing mostly with the array and "for" loops. Hopefully my questions make sense as I'm am so confused they may not be clear. I know the code works as I copied it straight from a book and ran it. I just can't follow what it's doing...
0
8159
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8314
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7922
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6571
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5689
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3811
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3836
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.