0

What's the difference between "if", "and", and "do-while"?

21st Oct 2016, 7:24 AM
Leslie Aula
Leslie Aula - avatar
9 Answers
+ 3
3 completely different things "if' is a keyword for conditions. "and" ? In C++, you use && for the AND operator. "do-while" is a kind of loop. like the while loop abd the for loop
21st Oct 2016, 10:42 AM
Quentin Perthuis
Quentin Perthuis - avatar
+ 3
'if' is used when you have to make 1 of 2 decision, like if(7>2){cout << "true";} else{cout << "false";} "while" on the hand is used when you want to repeat a certain code block within the condition given. Note that the while loop takes only one condition unlike the "for" loop that must have three
26th Oct 2016, 6:20 AM
Kai
Kai - avatar
+ 1
You use "if" when you need a condition. You use "do-while" wheb you need a loop that turn at least one time You use the AND operator wheb you want to a condition to verify two things for example : if ( (x > 0 ) && (x <= 10) ) { cout << "X is between 0 and 10, 10 included"; }
21st Oct 2016, 11:03 AM
Quentin Perthuis
Quentin Perthuis - avatar
+ 1
gud answers
23rd Oct 2016, 5:09 PM
Siddapuram Srisailam
Siddapuram Srisailam - avatar
0
i just wandering when "if" is used, when "and" is used, and when "while" used?
21st Oct 2016, 10:46 AM
Leslie Aula
Leslie Aula - avatar
0
thanks a lot for your answer
21st Oct 2016, 11:16 AM
Leslie Aula
Leslie Aula - avatar
0
If is a condition While is a loop In loop you can repeat the given condition But in if statement it derives true or false condition
27th Oct 2016, 4:59 PM
NITESH SAHARAN
NITESH SAHARAN - avatar
0
if is one time.. do while as many as you want..
5th Nov 2016, 3:14 PM
sahag
sahag - avatar
0
I am learning something here.
7th Nov 2016, 5:20 PM
Boas Sankalimba