当前位置:网站首页>Eight days of learning C language - while loop (embedded) (single chip microcomputer)
Eight days of learning C language - while loop (embedded) (single chip microcomputer)
2022-07-05 02:39:00 【Late night taverns don't drink】
When the conditions are met ,if Statement execution after statement , Otherwise, do not execute .
But this statement will only be executed once .
Because we find that many practical examples in life are : We need to finish the same thing many times .
So how do we do it ?
C Language introduces us : while sentence , It's possible to loop .
// Print... On the screen 1 - 10 The number of
//int main()
//{
// int i = 1;
// while (i <= 10)
// {
// printf("%d ", i);
// i++;
// }
//
// return 0;
//}
break and continue Introduce
// stay while In circulation ,break Used to permanently terminate the loop ;
// stay while In circulation ,continue The purpose of this is to skip this cycle
//( Code behind )
// Go directly to the judgment part , See if the next cycle ;
//int main()
//{
// int i = 1;
// while (i <= 10)
// {
// if (i == 5)
// break;
// continue;
// printf("%d ", i);
// i++;
// }
// return 0;
//}
getchar Introduce
//getchar
//EOF - end of file - End of file flag ;
//int main()
//{
// int ch=getchar();
// //printf("%c\n", ch);
// putchar(ch);// Output a character
// return 0;
//}
//int main()
//{
// int ch = 0;
// while ((ch = getchar())!=EOF)
// {
// putchar(ch);
//
// }//ctrl + z - getchar End of read ;
//
// return 0;
//}
//int main()
//{
// int password[20] = { 0 };
// printf(" Please input a password :>");
// scanf("%s", password);
// // Clean buffer
// //getchar();// Can only handle \n;
// // Method 2 : Clean up multiple characters in the buffer
// int tmp = 0;
// while ((tmp = getchar()) != '\n')
// {
// ;
// }
// printf(" Please confirm the password (Y/N)");
// int ch = getchar();
// if (ch == 'Y')
// {
// printf(" Confirm success \n");
// }
// else
// {
// printf(" Confirmation failed \n");
// }
//
// return 0;
//}
//int main()
//{
// int i = 1;
// while (i <= 10)
// {
// i = i + 1;
// if (i == 5)
// continue;
// printf("%d ",i);
// }
// return 0;
//}//2 3 4 6 7 8 9 10 11
//
//int main()
//{
// int i = 1;
// while (i <= 10)
// {
// if (i == 5)
// continue;
// printf("%d ", i);
// i = i + 1;
// }
// return 0;
//}//1 2 3 4
// The purpose of this code is :
// Print only numeric characters , Skip other characters .
//int main()
//{
// char ch = '\0';
// while ((ch = getchar()) != EOF)
// {
// if (ch < '0' || ch > '9')
// continue;
// putchar(ch);
// }
//
// return 0;
//}
//int main()
//{
// int ch = 0;
// while ((ch = getchar()) != EOF)// Get any character ;
// putchar(ch);// Output any character ;
// return 0;
//}
边栏推荐
- Hmi-31- [motion mode] solve the problem of picture display of music module
- Day_ 17 IO stream file class
- Which common ports should the server open
- Exploration of short text analysis in the field of medical and health (I)
- [understanding of opportunity -38]: Guiguzi - Chapter 5 flying clamp - warning one: there is a kind of killing called "killing"
- Can you really learn 3DMAX modeling by self-study?
- Pytest (4) - test case execution sequence
- Tucson will lose more than $400million in the next year
- 官宣!第三届云原生编程挑战赛正式启动!
- Design and implementation of kindergarten management system
猜你喜欢
[200 opencv routines] 99 Modified alpha mean filter
Design and implementation of community hospital information system
【LeetCode】106. Construct binary tree from middle order and post order traversal sequence (wrong question 2)
【LeetCode】222. The number of nodes of a complete binary tree (2 mistakes)
Moco V2 literature research [self supervised learning]
Asynchronous and promise
Yolov5 model training and detection
Marubeni Baidu applet detailed configuration tutorial, approved.
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience
Chinese natural language processing, medical, legal and other public data sets, sorting and sharing
随机推荐
Practice of tdengine in TCL air conditioning energy management platform
Collection of gmat750 wrong questions
The most powerful new household god card of Bank of communications. Apply to earn 2100 yuan. Hurry up if you haven't applied!
[技术发展-26]:新型信息与通信网络的数据安全
Single line function*
Spoon inserts and updates the Oracle database, and some prompts are inserted with errors. Assertion botch: negative time
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience
Advanced conditional statements of common SQL operations
RichView TRVStyle MainRVStyle
Pytorch register_ Hook (operate on gradient grad)
. Net starts again happy 20th birthday
使用druid连接MySQL数据库报类型错误
tuple and point
openresty ngx_lua变量操作
[机缘参悟-38]:鬼谷子-第五飞箝篇 - 警示之一:有一种杀称为“捧杀”
Missile interception -- UPC winter vacation training match
RichView TRVStyle MainRVStyle
Tucson will lose more than $400million in the next year
低度酒赛道进入洗牌期,新品牌如何破局三大难题?
Summary and practice of knowledge map construction technology