In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use selection and loop in C language, which is very detailed and has a certain reference value. Friends who are interested must finish reading it!
1. Select statement (if)
Let's not talk about switch first, but we will add later. Let's start with a simple if.
If (condition), through the judgment of the condition to determine which branch to execute, multi-branch we can use else if.
Since we are only doing a simple understanding, we look directly at the code.
As shown in the figure, our condition is age > = 18. When we enter 19:00, we determine that the condition is true, so we execute the first branch, that is, we output "you have come of age". Conversely, if the condition is false, we will output "you are not yet an adult".
two。 Cycle
Some things have to be done all the time, such as we have to eat every meal, walk step by step, and the code has to be tapped day after day. In the computer, we call it a loop. Loops are divided into finite loops and infinite loops (infinite loops are usually misoperated, if you're not trying to make fun of them).
Three elements of finite cycle: condition initialization, condition judgment, condition update
So let's go straight to the example.
While cycle
The following iTunes + is i=i+1, and we'll talk about the operator abbreviated below, as you can see, in this while loop, as long as it satisfies I.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.