Home > Back-end >  The Type or namespace definition, or end - of - file expected how to fix it
The Type or namespace definition, or end - of - file expected how to fix it

Time:11-21

Int main ()
{
Int choice;//user selection
//print the game menu
Printf (" personality test: \ n ");
Printf (" if you are a king, for the right partner you want? \n");
Printf (" 1, as long as there is a true love wife \ n ");
Printf (" 2, can be more than two lover \ n ");
Printf (" 3, three thousand beauty \ n ");
Do {
Printf (" please select: ");
The scanf (" % d ", & amp; Choice);
If (choice & lt;=0 | | choice & gt; 3);
{
Printf (" can only enter a number between 1-3! Please input again: \ n ");
}
} while (choice & lt;=0 | | choice & gt; 3);//to think: what choice, execute cycle
The switch (choice)
{
Case 1:
Printf (" you choose in the life the only ");
break;

Case 2:
Printf (" you are a flower heart big radish ");
break;
Case 3:
Printf (" jiangsu bag mail ");
break;
}
}
return 0;

The Error (s) :
(40:1) Type or namespace definition, or end - of - file expected

Small white a great god give directions:
Shown above errors need how to fix it?

CodePudding user response:

 # include & lt; stdio.h> 

Int main ()
{
Int choice;//user selection
//print the game menu
Printf (" personality test: \ n ");
Printf (" if you are a king, for the right partner you want? \n");
Printf (" 1, as long as there is a true love wife \ n ");
Printf (" 2, can be more than two lover \ n ");
Printf (" 3, three thousand beauty \ n ");
Do {
Printf (" please select: ");
The scanf (" % d ", & amp; Choice);
//if (choice & lt;=0 | | choice & gt; 3);//here a semicolon
If (choice & lt;=0 | | choice & gt; 3)
{
Printf (" can only enter a number between 1-3! Please input again: \ n ");
}
} while (choice & lt;=0 | | choice & gt; 3);//to think: what choice, execute cycle
The switch (choice)
{
Case 1:
Printf (" you choose in the life the only ");
break;

Case 2:
Printf (" you are a flower heart big radish ");
break;
Case 3:
Printf (" jiangsu bag mail ");
break;
}
return 0;
}

For your reference ~

Return 0 should be put in curly braces, the code is much more a semicolon
  • Related