1.4 1.4.7

Ziyan_Cai

New Member
C++ Student
I have successfully finished exercise 1.4.6. However, I get some problem with 1.4.7. When I tried to print the result with the switch case sentence, the result in the switch sentence is not printed. I don't know why. Following is the switch sentence I write:

switch (threes) //threes is the number of number three
{
case 0:printf("The number three appears zeros time."); break;
case 1:printf("The number three appears one time."); break;
case 2:printf("The number three appears two times."); break;
switch (threes > 3)
{
case true:printf("The number three appears more than two times."); break;
}
};
 

GONG CHEN

Well-Known Member
C++ Student
Try printf threes before this switch to see what the value is -- make sure it's initialized and then incremented correctly.
 

GONG CHEN

Well-Known Member
C++ Student
Yeah! I remained the print result of exercise 1.4.6. This result is right, but the result of switch is not printed.
Is it not printing when threecount is three or larger? -- if so, check the logic of switch again, this case can be simplified.
 
Top