Day 4: loop structure (while, do... While, ),... While1. Loop Structure (while, do... While,)
1.1. What is a loop structure
In daily life, there will be a lot of things that need to be done repeatedly, such as four seasons of every year, 7 days of
1. Loop Structure (while, do... While,)
1.1. What is a loop structure
In daily life, there will be a lot of things that need to be done repeatedly, such as four seasons of every year, 7 days of every week, 3 meals a day, and 50 copies of each
1.while:Convert for to while,a//for (int i = 1; i B//int i=1;-------in front of the whilewhile (iThe difference between the two is that the for parenthesis contains: initial conditions, cyclic condition, state change, and curly braces.While:
In js, the loop statements while and do while are also one of our commonly used loop statements. Next I will introduce you to the usage of the while and do-while loops, and hope to help you.
While Loop
The while statement is similar to the if
Using Do-while statements to form loopsThe Do-while statement is characterized by executing the loop body first, and then judging whether the cyclic condition is tenable. Its general form is:
Do
statement while
(expression);
It
Use the for and while loops to calculate the value of e [e = 1 + 1/1! + 1/2! + 1/3! + 1/4! + 1/5! +... + 1/n!], While
/* Write a program and calculate the value of e according to the following formula. Two calculation methods are required: 1) for
Swift Learning -- use if and switch for conditional operations, and use for, while, and do-while for Loop
// Switch supports any type of data and various comparison operations-not only integers and test equality
// If the default program is
Swift Learning-use if and switch for conditional operation, use For,while, and do-while to cycle//switch supports arbitrary types of data and a variety of operations- - not only integers, but also test equivalence// Note that if you remove the
The structured statements in c ++ determine the use of if branch statements switch loop statements while and do while loop statements for, structured switch
Job 1:
Use the if statement, according to 1 ~ 7. What is the day of the week output? Program.
Efficient Data Synchronization Method and Efficiency Test-20150105 decompression while compressing while transmitting while packing
Sometimes it takes a long time to back up or synchronize large directories with many files (such as several GB or
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.