While loop not working?

For my CSC100 class we are supposed to write a menu-driven program, and the first option is a while loop that displays a row of 15 asterisks. Below is my code, it has no errors, but it isn't displaying the row of asterisks?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>

using namespace std;

void main()
{

char answer;
int count = 1;

do
{
cout << "1 - A while loop that produces 15 asterisks" << endl
     << "2 - A for loop that produces 15 asterisks" << endl
     << "3 - Produces the odd numbers between 1 and 50" << endl
     << "4 - Enter a positive number and it produces the integers from 1 to that number" << endl
     << "5 - Enter a positive number and it produces the integers from that number down to 1" << endl
     << "6 - Enter a positive number and it adds the integers from 1 to your number" << endl
     << "7 - Enter a positive number and it will make a table of integers from 1 to your number" << endl
     << "8 - Produces a diagonal line of asterisks" << endl
     << "9 - Produces a right triangle made of asterisks" << endl
     << "10 - Produces an upside down right triangle of astericks" << endl
     << "13 - Quit" << endl
     << "Enter a option: ";

cin >> answer;

if (answer == 1)
{
	while ( count < 16 );
	{ cout << "*" << endl;
	count++;
	}
}
}

while ( answer != 13 );


}



If you guys could help me in any way, that would be great. Thank you (:
Several issues here. First void main() is not valid. Your compiler may accept it but it doesn't conform to the C++ standard. It should be int main()

answer is of type char. That is, a single character. Thus you need to compare it with a character, like this: if (answer == '1')

Next, the while loop at line 30, while ( count < 16 ); - this line should not end with a semicolon, as that would indicate the end of the body of the loop. Remove the semicolon.

One more issue, you won't be able to enter "13" to exit, as that is two characters, not one. You could either change the menu, for example require the user to enter 'q' to quit. Alternatively, change the type of answer to int and make sure you are comparing this to an integer value.
Wow, thank you so so so much!
And I used void main just because my teacher always uses that, but from now on I will be using int main, again, thank you!
I used void main just because my teacher always uses that


I'm so, so, so sorry.
Topic archived. No new replies allowed.