当前位置:网站首页>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;
//}边栏推荐
- 100 basic multiple choice questions of C language (with answers) 04
- RichView TRVUnits 图像显示单位
- openresty ngx_ Lua variable operation
- Visual explanation of Newton iteration method
- When to catch an exception and when to throw an exception- When to catch the Exception vs When to throw the Exceptions?
- Talk about the things that must be paid attention to when interviewing programmers
- 如何做一个炫酷的墨水屏电子钟?
- Data guard -- theoretical explanation (III)
- 2022/02/13
- Design and practice of kubernetes cluster and application monitoring scheme
猜你喜欢
![ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience](/img/22/08617736a8b943bc9c254aac60c8cb.jpg)
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience

The application and Optimization Practice of redis in vivo push platform is transferred to the end of metadata by

A label making navigation bar

Exploration of short text analysis in the field of medical and health (I)

Design and implementation of community hospital information system

Design and implementation of kindergarten management system

Subject 3 how to turn on the high beam diagram? Is the high beam of section 3 up or down

Naacl 2021 | contrastive learning sweeping text clustering task

Spoon inserts and updates the Oracle database, and some prompts are inserted with errors. Assertion botch: negative time

Official announcement! The third cloud native programming challenge is officially launched!
随机推荐
Hmi-32- [motion mode] add light panel and basic information column
Spark SQL learning bullet 2
Structure of ViewModel
Zabbix
Advanced conditional statements of common SQL operations
Returns the lowest common ancestor of two nodes in a binary tree
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 1)
Why do you understand a16z? Those who prefer Web3.0 Privacy Infrastructure: nym
ELFK部署
Talk about the things that must be paid attention to when interviewing programmers
Binary tree traversal - middle order traversal (golang)
openresty ngx_ Lua execution phase
Kotlin - 协程 Coroutine
Unpool(nn.MaxUnpool2d)
Erreur de type de datagramme MySQL en utilisant Druid
数据库和充值都没有了
Good documentation
TCP security of network security foundation
[technology development-26]: data security of new information and communication networks
Hmi-31- [motion mode] solve the problem of picture display of music module