当前位置:网站首页>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
边栏推荐
- [daily algorithm 94] classic interview question: motion range of robot
- Ctfshow ultimate assessment
- MySQL基础知识学习(一)
- How to optimize the deep learning model to improve the reasoning speed
- Openharmony Mengxin contribution Guide
- 函数防抖节流
- 一些实用、常用、效率越来越高的 Kubernetes 别名
- Unity3d 2021 software installation package download and installation tutorial
- Mangodb simple to use
- C# 窗体应用常用基础控件讲解(适合萌新)
猜你喜欢

ctfshow 终极考核

Restful

Pytorch custom CUDA operator tutorial and runtime analysis

ES6 new - deconstruction assignment of array / object

How to deploy yolov6 with tensorrt

巴比特 | 元宇宙每日必读:广州南沙发布“元宇宙九条”措施,平台最高可获得2亿元资金支持...

Cross domain and processing cross domain

Antdesign a-modal user-defined instruction realizes dragging and zooming in and out

500报错

Is the operation of assigning values to int variables atomic?
随机推荐
500 error reporting
pollFirst(),pollLast(),peekFirst(),peekLast()
Activation functions commonly used in deep learning
07_ Service registration and discovery summary
[C language - zero foundation lesson 8] circular structure and break continue
Antdesign a-modal自定义指令实现拖拽放大缩小
【微服务~Sentinel】Sentinel之dashboard控制面板
ES6 new symbol data type
Apple cut its price by 600 yuan, which was almost a devastating blow to the collapse of its domestic flagship mobile phone
Tensorflow package tf.keras module construction and training deep learning model
Pytorch custom CUDA operator tutorial and runtime analysis
Programming style
PVT的spatial reduction attention(SRA)
B tree
NPM install error forced installation
[C language - zero basis _ study _ review _ lesson 5] operational properties of basic operators
基于ArkUI eTS开发的坚果食谱(NutRecipes
C# 窗体应用常用基础控件讲解(适合萌新)
基于ArkUI eTS开发的坚果笑话(NutJoke)
二叉树讲解