Histogram program help

I essentially want to be able to show multiple symbols based off a variable.
Ie, my variable is random based of srand(time()) now i want to be able to have this variable to create a random amount lines within a display, so it needs to look something like this

1-10: ||||

The lines are the variable which must be able to change each time the program changes. This also must be done without using force programming or something like this ( must use looping structures, most preferably while not for)
if (oneToTen == 2)
{
cout << "-10: || " << endl;
}
else if (oneToTen == 3)
{
cout << "0-10: |||" << endl;
}
Sorry if I sound stupid but I've only been in my computer science course for a couple weeks now and this is still quite confusing to me, please correct me on any logical errors regarding what I can and can't do.
Last edited on
Use a loop for this:
1
2
3
4
5
6
cout << "0-10: ";
for(int i = 0; i < oneToTen; ++i)
{
  cout << "|";
}
cout << endl;
Your help is much appreciated!
Topic archived. No new replies allowed.