In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
C language programming in what is the use of if, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
Sequence, selection and loop are the three basic structures of a program, and no matter how complex the program is, it is written with these three structures.
Usage of if (example 1)
# include
Int main (void)
{
If (true)
If (false)
Printf ("!\ n")
Else
Printf ("hehe!\ n"); / / pay attention to the correspondence between else and if, and the correspondence between else and if is from the middle to the opposite end.
If (true)
{
If (false)
Printf ("!\ n")
}
Else
Printf ("hehe!\ n"); / / for else to correspond to the first if, you must enlarge parentheses on the if statement that should correspond to it to make it a separate sentence.
Return 0
}
Program output:
Example 2
# include
Int main (void)
{
If (3) / / if (): deal with true or false, 0 is false, non-0 is true
{
Printf ("AAAA\ n")
Printf ("BBBB\ n")
}
Return 0
}
Program output:
Example 3
# include
Int main (void)
{
/ / int i, j
/ / printf ("Please enter the value of I j:")
/ / scanf ("d d", & I, & j)
If (2 times 3)
Printf ("I is greater than j\ n")
Else
Printf ("I is less than j\ n")
Return 0
}
Program output:
Example 4:
# include
Int main (void)
{
Int x
Int y
Printf ("Please enter a value for x:")
Scanf (& d, & x)
Y = 0
If (x > = 0)
If (x > 0)
Y = 1
Printf ("y =% d\ n", y)
Return 0
}
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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