当前位置:网站首页>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;
//}
边栏推荐
- Official announcement! The third cloud native programming challenge is officially launched!
- GFS distributed file system
- Hmi-31- [motion mode] solve the problem of picture display of music module
- Pytorch register_ Hook (operate on gradient grad)
- Use the difference between "Chmod a + X" and "Chmod 755" [closed] - difference between using "Chmod a + X" and "Chmod 755" [closed]
- . Net starts again happy 20th birthday
- Moco V2 literature research [self supervised learning]
- Talk about the things that must be paid attention to when interviewing programmers
- Spoon inserts and updates the Oracle database, and some prompts are inserted with errors. Assertion botch: negative time
- 使用druid連接MySQL數據庫報類型錯誤
猜你喜欢
Subject 3 how to turn on the high beam diagram? Is the high beam of section 3 up or down
[200 opencv routines] 99 Modified alpha mean filter
Cut! 39 year old Ali P9, saved 150million
Asp+access campus network goods trading platform
Official announcement! The third cloud native programming challenge is officially launched!
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
【LeetCode】110. Balanced binary tree (2 brushes of wrong questions)
Hmi-30- [motion mode] the module on the right side of the instrument starts to write
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 1)
Yolov5 model training and detection
随机推荐
spoon插入更新oracle数据库,插了一部分提示报错Assertion botch: negative time
【附源码】基于知识图谱的智能推荐系统-Sylvie小兔
[illumination du destin - 38]: Ghost Valley - chapitre 5 Flying clamp - one of the Warnings: There is a kind of killing called "hold Kill"
Design and implementation of community hospital information system
d3js小记
From task Run get return value - getting return value from task Run
Video display and hiding of imitation tudou.com
Richview trvunits image display units
Advanced conditional statements of common SQL operations
Day_ 17 IO stream file class
Spark SQL learning bullet 2
How to find hot projects in 2022? Dena community project progress follow-up, there is always a dish for you (1)
Limited query of common SQL operations
Returns the lowest common ancestor of two nodes in a binary tree
【LeetCode】501. Mode in binary search tree (2 wrong questions)
Collection of gmat750 wrong questions
Talk about the things that must be paid attention to when interviewing programmers
Medusa installation and simple use
Action News
[source code attached] Intelligent Recommendation System Based on knowledge map -sylvie rabbit