当前位置:网站首页>C language learning log 10.10
C language learning log 10.10
2022-06-13 04:57:00 【Today is also a day without baldness】
One .Switch-case
Format :
switch( Control statement ){
case Constant :
sentence
...
case Constant :
sentence
...
default:
sentence
...
}
Control expressions can only be integer results , Constants can be constants , It can also be an expression for constant calculation .
switch Statement can be regarded as a calculation based jump , After calculating the value of the control expression , The program will jump to the matching case( Branch label ) It's about . The branch label just indicates swich Road signs at internal locations , After executing the last statement in the branch , If not at the back break, It will be executed in sequence to the following case Go inside , Until I met a break, perhaps switch End .
Two . Test for weight gain
#include<stdio.h>
int main(void)
{
int H,x;
double W;
scanf("%d",&x);
if(x>100&&x<=300){
H=x;
}
W=(H-100)*0.9*2;
printf("%.1f",W);
}
3、 ... and . Calculate the average and sum
#include<stdio.h>
int main(void)
{
int a,b,c,d,Sum;
double Average;
scanf("%d %d %d %d",&a,&b,&c,&d);
Sum=a+b+c+d;
Average=(a+b+c+d)/4.0;
printf("Sum = %d; Average = %.1f",Sum,Average);
}
边栏推荐
猜你喜欢
利用Javeswingjdbc基于mvc设计系统
利用Javeswingjdbc基於mvc設計系統
Article 29: assuming that the mobile operation does not exist, is expensive, and is not used
约瑟夫问题
The games that you've tasted
Sampo Lock
Design system based on MVC using javeswingjdbc
Explain the role of key attribute in V-for
QT interface rendering style
[LeetCode]-二分查找
随机推荐
Logical point
利用Javeswingjdbc基於mvc設計系統
Configuration used by automatic teaching evaluation script
Converting MySQL data to PostgreSQL with Navicat
135. distribute candy
Handwritten promise and its method, with detailed notes
[JS solution] leedcode 117 Populate the next right node pointer II for each node
QT interface rendering style
Conception d'un système basé sur MVC avec javaswing JDBC
Bomb disposal cat
Colab tutorial (super detailed version) and colab pro/pro+ evaluation
约瑟夫问题
Mysql8.0.13 installation tutorial (with pictures)
Common skills in embedded programming
rainbow
Clause 33: decltype is used for auto & type formal parameters, with std:: forward
Advanced C language - Section 1 - data storage
小C的记事本
[LeetCode]-二分查找
C language exercise 1