{
Int hight.
Scanf_s (" % d ", & amp; Hight);
If (hight & gt;
=180){
Printf (" xiaoming can enter the basketball team ");
}
Else if (175 & lt;=hight & lt; 180)
{
Printf (" xiaoming can enter the basketball reserve ");
}
The else (hight & lt; 175);
{
Printf (" xiao Ming can't enter the basketball team ");
}
return 0;
}
Then debug result:
160
Xiao Ming can enter the substitute xiao Ming can't enter the basketball team basketball team
E: \ ConsoleApplication12 \ Debug \ ConsoleApplication12 exe process (11664) have withdrawn, the code is 0,
To debug stops automatically shut down the console, please enable "tool" - & gt;" Options - & gt; "" Debugging - & gt; "" Debugging stops automatically shut down the console, "
Press any key to close this window...
I just learn C, I am using Visual Studio, the programming software problem?
CodePudding user response:
Not have this kind of writing (175 & lt;=hight & lt; 180).CodePudding user response:
Don't doubt the software problem, first thought is their own problems, to find their own problems easier than looking for a software problem, can change to thisIf (hight & gt;
=180)14
{
15
Printf (" xiaoming can enter the basketball team ");
16
}
17
Else if (175 & lt;=hight & amp; & Hight & lt; 180)
18
{
19
Printf (" xiaoming can enter the basketball reserve ");
20
}
21
The else (hight & lt; 175);
22
{
23
Printf (" xiao Ming can't enter the basketball team ");
24
}
CodePudding user response:
Ok, don't understand asked,Int main ()
{
Int hight.
Scanf_s (" % d ", & amp; Hight);
If (hight & gt;
=180){
Printf (" xiaoming can enter the basketball team ");
}
Else if (175 & lt;=hight & amp; & Hight & lt; 180)
{
Printf (" xiaoming can enter the basketball reserve ");
}
The else (hight & lt; 175);
{
Printf (" xiao Ming can't into the basketball team ");
}
return 0;
}
Results: 176
Xiao Ming can enter the basketball team can't substitute Ming into the basketball team
Changed:
Int main ()
{
Int hight.
Scanf_s (" % d ", & amp; Hight);
If (hight & gt;
=180){
Printf (" xiaoming can enter the basketball team ");
}
Else if (175 & lt;=hight & amp; & Hight & lt; 180)
{
Printf (" xiaoming can enter the basketball reserve ");
}
Else if (hight & lt; 175)
{
Printf (" xiao Ming can't into the basketball team ");
}
return 0;
}
Results: 176
Xiao Ming can enter the basketball reserve
I was in the third else + the if, how two results before and after different?
CodePudding user response:
The first to the last else behind a semicolonCodePudding user response:
CodePudding user response: