Hi, i have a lot of errors on this and am not sure how to fix it. This needs to be turned in in 2 hours so all help is needed =)).

Description: Design and implement an application that creates a histogram that allows you to visually inspect the frequency distribution of a set of values. The program should read in an arbitrary number of integers that are in the range 1 – 100 inclusive, then produce a chart similar to the one below that indicates how many input values fell in the range of 1 to 10, 11 – 20, and so on. Print one asterisk for each value entered. After the histogram has been displayed, allow the user to clear the screen and create another one as many times as he wishes.

1 – 10 | **************************
11 – 20 | ***
21 – 30 |******
31 – 40 |**
41 – 50 |*
51 – 60 |
61 – 70 |************************************
71 – 80 |***
81 – 90 |****************
91 – 100 | **


MY CODE IS HERE.

#include <iostream>
#include <iomanip>
using namespace std;

//local variables
int data = 0;

/**************************start main program*********************/
int main()
{
    int arraySize[15] ;
	int array[arraySize] = 0;
	
	cout<<"Enter a list of numbers: ";
	cin >> data ;
	
	//Determine what range the number entered is in
	if (data =>1 && data <10) {array[0]++; };
	else if (data =>11 && data <20) {array[1]++; };
	else if (data =>21 && data <30) {array[2]++; };
	else if (data =>31 && data <40) {array[3]++; };
	else if (data =>41 && data <50) {array[4]++; };
	else if (data =>51 && data <60) {array[5]++; };
	else if (data =>61 && data <70) {array[6]++; };
	else if (data =>71 && data <80) {array[7]++; };
	else if (data =>81 && data <90) {array[8]++; };
	else if (data =>91 && data <100) {array[9]++;};
	else break;
}
	
	//Display screen
cout << "1-10: ";
cout << "11-20: ";
cout << "21-30: ";
cout << "31-40: ";
cout << "41-50: ";
cout << "51-60: ";
cout << "61-70: ";
cout << "71-80: ";
cout << "81-90: ";
cout << "91-100: ";

for (i=0;i<array[j];i++) {cout << "*"; };

if anyone can touch it up and lemme know where i went wrong i would greatly appreciate it, tried to contact teacher but no luck. thank you.

Unless you specifically send a linebreak to cout, it will keep printing on the same line, so basically you need:

cout <<" 1-10";
for loop(over the number of stars for that range)
      cout <<"*";
cout <<endl;  //go to the next line

Unless you specifically send a linebreak to cout, it will keep printing on the same line, so basically you need:

cout <<" 1-10";
for loop(over the number of stars for that range)
      cout <<"*";
cout <<endl;  //go to the next line

ok so would it look like this for each cout statment?

cout << "1-10: ";
for(int j = 0; j < array[]; j++)
cout <<"*";

cout << "11-20: ";
for(int j = 0; j < array[]; j++)
cout <<"*";

im not sure how to show how many stars should be given to each range

>ok so would it look like this for each cout statment?
Do you even own a book on C++? You're making mistakes that would cause a 1st day beginner to blush in embarrassment.

>im not sure how to show how many stars should be given to each range
What the heck? The array exists for that sole purpose! I order you to stop writing code immediately. You're not ready for that step yet. You need to understand the problem completely first. You need to understand the solution completely after that. And you need to understand enough of C++ not to completely fuck up the code when you actually do start typing.

This assignment is clearly beyond your abilities at the moment, and if we help you hack it into actually working, you're not going to be any better off on the next assignment.

pointless post above, im not taking this class by choice. nor do i care for it. i just want to finish this assignment, and your 2cents was no help.

>i just want to finish this assignment
What will you do on the next assignment? And the next? And the one after that? The class will get harder and harder, and you'll not get any less ignorant. You're going to fail this class with that attitude, I guarantee it.

>and your 2cents was no help
If you're not interested in learning, I'm not interested in helping you. Good luck finding someone who will constantly "touch up" your crap code, because nobody competent will waste their time on a lost cause like you.

sadly to tell you this is the last assignment then the class is over. the class teaches you the basics of c++ and is mandatory to take for my major. obviously i didnt take the class seriously and obviously this is your life. get over yourself and stop thinking i want to learn this stuff...i dont. after this class is over with ill be dealing with c++ never again.

pointless post above, im not taking this class by choice. nor do i care for it. i just want to finish this assignment, and your 2cents was no help.

So with 'i just want to finish this assignment' you mean : 'i just want YOU to finish this assignment'?
I suggest you start putting in some effort from now on. Narue gave you some good advice, and your response is an insult. Keeping up this attitude will get this thread closed, and get you infracted.

So with 'i just want to finish this assignment' you mean : 'i just want YOU to finish this assignment'?
I suggest you start putting in some effort from now on. Narue gave you some good advice, and your response is an insult. Keeping up this attitude will get this thread closed, and get you infracted.

plz dont post in my thread unless you have tried to help, mind ur buisness

commented: Idiot. -1

>plz dont post in my thread unless you have tried to help
I tried to help and you made your stance on willful ignorance and biting the hand that feeds you quite clear. You might as well just go away, because nobody is going to help you now.

when i said that it was to neik.

and i already completed the assignment, found actual help much better then what you fools are able to give.

i find that people who do c++ for a living have little social skills and fail to be apart of socail events in their lifes, reason why c++ is not for me.

when you try and insult someone over a forum dont think you know them....you dont.

plz dont post in my thread unless you have tried to help, mind ur buisness

As a mod I'm here to make sure people follow the rules. I gave you a warning to put in some effort and to keep it pleasant. You failed to do so, so you're not getting any help. That's how it works in real life and that's how it works in forums.

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.