当前位置:网站首页>The second day of learning C language
The second day of learning C language
2022-07-27 09:16:00 【ruin987】
Judge
#include <stdio.h>
int main()
{
printf("%d\n", 5 == 3);
printf("%d\n", 5 > 3);
printf("%d\n", 5 <= 3);
return 0;
// Everything from the back to the end is ignored by the computer ,// The following is for comments
/**/ In the middle of the slash is the comment
A multiline comment consists of a pair of character sequences " / * " Start , And then ” * / “ end .
Nested IF function
if(gameover==0){
if(player2move==2)
printf("Your turn\n");
}else
printf("GAME OVER\n");
To be in IF and else Followed by parentheses
Switch-case
int type;
scanf("%d", &type);
switch (type) {
case 1:
printf(" Hello ");
break;
case 2:
printf(" Good morning ");
break;
case 3:
printf(" Good evening ");
break;
case 4:
printf(" bye ");
break;
default:
printf(" ah , What ah? ?");
}
break: Is to jump out to the output ( Can only jump out of the loop )
continue: Skip this round of the loop and the rest of the statements go to the next round ( Can only jump out of the loop )
The algorithm of the number of digits
1. User input x;
2. initialization n by 0;
3.x = x / 10, Take out the bits ;
4.n++;
5. If x>0, go back to 3;
otherwise n It's the result
int x;
int n = 0;
scanf("%d", &x);
n++;
x = 10;
while (x > 0) {
n++;
x = 10;
}
printf("%d\n", n);
DO-while
do
{
< Loop body statement >
}while(< Loop statement >);
IF It's disposable ;
while It's repeated ;
#include<stdio.h>
const int MINOR = 35;
int age = 0;
printf(" Please enter your age :");
scanf("%d", &age);
printf(" Your age is %d year .\n,age");
if (age < MINOR) {
printf(" Youth is beautiful ,");
}
printf(" Age determines your spiritual world , Cherish it .\n");
goto< name >
name :
goto: Jump directly to the location of the name
边栏推荐
- Mangodb simple to use
- Tensorflow package tf.keras module construction and training deep learning model
- [daily algorithm 94] classic interview question: motion range of robot
- 如何注册码云账号
- [C language - zero foundation lesson 7] sequential structure and selection structure
- [interprocess communication IPC] - semaphore learning
- 罗克韦尔AB PLC 通过RSLinx Classic与PLC建立通信的具体方法步骤
- 07_ Service registration and discovery summary
- Programming style
- HUAWEI 机试题:字符串变换最小字符串 js
猜你喜欢

Ctfshow ultimate assessment
![[C language _ study _ exam _ review lesson 3] overview of ASCII code and C language](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[C language _ study _ exam _ review lesson 3] overview of ASCII code and C language

C# 窗体应用常用基础控件讲解(适合萌新)
![[C language - zero foundation lesson 6] input and output sentence format and compound sentence](/img/d5/b9935a37b634db7f5740779009e44f.png)
[C language - zero foundation lesson 6] input and output sentence format and compound sentence

NPM install error forced installation

Pytorch custom CUDA operator tutorial and runtime analysis

Restful

The execution sequence of async/await, macro tasks and micro tasks

8 kinds of visual transformer finishing (Part 1)

npm install报错 强制安装
随机推荐
[C language _ review _ learn Lesson 2] what is base system? How to convert between hexadecimals
Is the operation of assigning values to int variables atomic?
Replace restricts the text box to regular expressions of numbers, numbers, letters, etc
MySQL transaction
Storage and computing engine
How to register code cloud account
Flex layout (actual Xiaomi official website)
如何注册码云账号
B tree
ES6 new - object part
[C language - zero basis _ study _ review _ lesson 5] operational properties of basic operators
MATLAB data import -- importdata and load functions
全排列递归思路整理
Two tips in arkui framework
[C language - zero foundation lesson 7] sequential structure and selection structure
罗克韦尔AB PLC 通过RSLinx Classic与PLC建立通信的具体方法步骤
ES6 new - string part
Deep understanding of Kalman filter (2): one dimensional Kalman filter
QT uses SQLite to open multiple database files at the same time
NPM install error forced installation