Home > Back-end >  For help
For help

Time:01-19

There is an if inside a code written assignment is to require ~ else, switch, for, while, break
Has done a computer C, but it is used to switch and while there are break
If ~ else and for really don't know how to add
A great god can you help me to improve my studying abroad, Japanese can ignore
Thank you very much!
The following is completed
#include
Void menu ()
{
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" * * * * * * * * * * * * * * * * * * * * * * add and subtract 乗 except electricity zhuo * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" * sentaku し た calculation method of 1 ~ 4 を し into force, the Enter を detain し て く だ さ い, * \ n ");
Printf (" 1 + \ n ");
Printf (" (2) - \ n ");
Printf (" 3. * \ n ");
Printf (" 4./\ n ");
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
}
Int main (void)
{
int i=0;
Int j=0;
int num=0;
Int the select=0;
Do
{
The menu ();
Scanf_s (" % d ", & amp; Select);
Printf (" 1 つ digital を し into force, the Enter を detain し て く だ さ い, 2 back Qiao り return す こ と が necessary で す, ");

Scanf_s (" % d % d ", & amp; I, & amp; J);
The switch (select)
{
Case 1:
Printf (" % d % d=% d \ n ", I, j, num=I + j).
break;
Case 2:
Printf (" % d, % d=% d \ n ", I, j, num=I - j);
break;
Case 3:
Printf (" % d % d *=% d \ n ", I, j, num=I * j);
break;
Case 4:
Printf (" % d/d=% d \ % n ", I, j, num=I/j);
break;
Default:
Printf (" into the force ミ ス は, reentry force し て く だ さ い, ");
break;
}
} while (select);
return 0;
}

CodePudding user response:

If ~ else and switch are structure, branch is selected for and the while loop structure, break should be out of circulation in here, you are supposed to write a arithmetic of the program? Two kinds of structure to choose one of these combinations can be inside, unnecessary are used throughout the year

CodePudding user response:

All unnecessary to use (old one what recently, heart good tired)

CodePudding user response:

 # include 
Void menu ()
{
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" * * * * * * * * * * * * * * * * * * * * * * add and subtract 乗 except electricity zhuo * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" * sentaku し た calculation method of 1 ~ 4 を し into force, the Enter を detain し て く だ さ い, * \ n ");
Printf (" 1 + \ n ");
Printf (" (2) - \ n ");
Printf (" 3. * \ n ");
Printf (" 4./\ n ");
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
}
Int main (void)
{
int i=0;
Int j=0;
int num=0;
Int the select=0;
Do
{
The menu ();
//scanf_s (" % d ", & amp; Select);
The scanf (" % d ", & amp; Select);
Printf (" 1 つ digital を し into force, the Enter を detain し て く だ さ い, 2 back Qiao り return す こ と が necessary で す, ");

//scanf_s (" % d % d ", & amp; I, & amp; J);
The scanf (" % d % d ", & amp; I, & amp; J);
The switch (select)
{
Case 1:
Printf (" % d % d=% d \ n ", I, j, num=I + j).
break;
Case 2:
Printf (" % d, % d=% d \ n ", I, j, num=I - j);
break;
Case 3:
Printf (" % d % d *=% d \ n ", I, j, num=I * j);
break;
Case 4:
If (j==0) {
Printf (" Input error! \n");
break;
}

Printf (" % d/d=% d \ % n ", I, j, num=I/j);
break;
Default:
Printf (" into the force ミ ス は, reentry force し て く だ さ い, ");
break;
}
} while (select);
return 0;
}

For your reference ~

Note as a division, j!=0

CodePudding user response:

Only an if, and else and for zha
  • Related