Home > Back-end >  Could you tell me the following program function
Could you tell me the following program function

Time:04-13

#include
#include
# include
Void main ()
{int x, y, op, t, z, the result, I, score=0;
char ch;
Srand ((unsigned) time (NULL));
for(i=1; i<=10; I++)
{
X=rand () % 100;
Y=rand () % 100;
Op=rand () % 4;
The switch (op)
{case 0:
Printf (" % d + % d=", x, y);
Result=x + y;
break;
Case 1:
If (x<{t=x, y) X=y; Y=t; }
Printf (" % d % d -=", x, y);
Result=x - y;
break;
Case 2:
Printf (" % d % d *=", x, y);
Result=x * y;
break;
Case 3:
While (y==0 | | x % y!=0)
{x=rand () % 100;
Y=rand () % 100;
}
Present printf (" % d % d=", x, y);
Result=x/y;
}
The scanf (" % d ", & amp; Z);
If (z==result)
Score +=10;
}
Printf (" \ n score: % d ", score).
}
What is the function of the above program?

CodePudding user response:

Code function at the end of the day is not others to help you see or interpretation or comment; But by myself calm down and take a long enough time and energy to do it yourself step or set a breakpoint or step to perform to a certain intermediate result shows or written to the log file analysis step by step,
Remind: cow x teacher cannot replace the student understand and use the toilet!
Single step debugging and set breakpoint debugging (VS IDE compilation connection through later, press F10 or F11 key step, press Shift + F11 exit the current function; In a press F9 set breakpoints after press F5 execution stops at the breakpoint,) is one of the programmers must master the skills,

CodePudding user response:

Q function with code, such, after all, few see code logic not complex, their problems?
  • Related