This work belongs courses | C language programming ll |
---|---|
The job requirements | (https://edu.cnblogs.com/campus/zswxy/SE2019-4/homework/9928) |
My aim in this course | Learn to use C language and use to write small programs |
This job helped me in terms of what specific goals | Learn to use switch handle multi-branch issues |
references | C language programming, Baidu |
7-11 Programming exam
* scanf put the switch inside the line causing the error, you can move to the outside of the
building test data
Input data | Output Data |
---|---|
120621 | Hunan agriculture university |
803654 | other university |
421621 | Aerospace university |
the include <stdio.h>
int main (void)
{
int Account, Y; (defined variables)
Scanf ( "% D", & Account);
Y = Account / 100000; (obtained in the first digit numbers)
Switch (Y )
{
(and corresponding input case University)
}
return 0;
}
7-12 student achievement statistics
* forget the definition of A = B = C = D = E = 0, add it
Create test data
Input data | Output Data |
---|---|
17 76 56 94 73 60 65 69 | 1 0 2 3 1 |
34 42 99 88 77 66 | 1 1 1 1 2 |
86 83 81 34 64 42 | 0 3 0 1 2 |
the include <stdio.h>
int main ()
{
int (defined variables)
the while (N)
{
N-N =. 1;
Scanf ( "% D", & Grade);
Switch (Grade / 10)
(and the corresponding fifth input case the number of accumulation system)
output (a, B, C, D, E)
return 0;
}
Code peer assessment
of my code
classmates code
for loop I use a while loop with students of
a longer code for students, because he used the case 0--8
My code
classmates code
* students is a direct switch (account / 100000) and I y is defined as a digital representation of a number to
summarize
3.1 learning progress bar
Week / Week | This week the time spent | Lines of code | Learned knowledge Introduction | Currently more confusing issues |
---|---|---|---|---|
Week Seven | 12h | 180 | if-else statement | Some symbols input and output |
Eighth Week | 9h | 270 | for loop | Decimal digits reserved |
Week Nine | 13h | 400 | Custom Functions | Some formatting issues tables and graphs |
The tenth week | 12h | 550 | Multi-branch else-if and character | Some operational character representation |
Week 11 | 11h | 680 | switch statement | The problem of the return value is ignored |
Summarize learning and insights
- The study of the switch statement, case back to take a constant expression
- Does not belong break we will continue to execute subsequent statements section
- Omit default, when the expression is not equal to the constant, would be nothing execution
I feel the need to review some previous knowledge or else forget
mind Mapping