while ( expression ) { statement; }The expression is evaluated;If it is non-zero, statement is executed;The expression is re-evaluated.Therefore, while continues cycling until expression becomes zero: void main() { int x = 0; while ( x < 5 ) { // condition // loop body: x = x + 1; } }
C++
Topic: Control Flow
Example of while loop?
Browse random answers:
Write programs using nested loops to produce the following design: * * * * * * * * *
What is Downcasting ?
#include <iostream>using namespace std;int foot (int x, int y) {return((x+y)*3);}int main() {int a = 1;int b = 2;do {cout << foot(b,a);} while ( b < a);return 0;}
Differentiate between the message and method.
What are the decision making statements?
What is the output with using decision making statements method?void main(){ int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n");}
What are conditional operators?
What is the output with using conditional operators method ?void main() {if(~0 == (unsigned int)-1)printf(“You can answer this if you know how values are represented in memory”); }
What is the default scope of if statement?
What is the output?main(){ float me = 1.1; double you = 1.1; if(me==you)printf("I love U");else printf("I hate U");}
Is it necessary if block always nested with else block?
What is the output?int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }
What is the purpose of break and continue statement?
What is the output?main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }
What is the control flow?
What is the purpose of using do-while loop?
At which condition switch statement is used?
What is the subtle error in the following code segment?void fun(int n, int arr[]){int *p=0;int i=0;while(i++<n) p = &arr[i];*p = 0;}
What is the difference between while and do while?
What is the output?main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j);}
What is difference between for loop and while loop ?
hat is the output?main(){while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }
What are Structured programming and C++ flow contro?l
Example of if-else statement?
Example of if-else statement example
Example of else-if construct(else-if ladder)
Example of while loop?
Example of for loop?
Example of break statement?
Example of continue statement
Definition Logical And && ?
Definition Logical Or ||
Definition Logical Not ! ?
Definition Logical Equals == ?
Definition Logical Not Equal != ?
Definition Strictly greater than > ?
Definition Greater than or equal to >=?
Definition Strictly less than < ?
Definition Less than or equal to <= ?
Definition Modulo Division % ?
Definition Incrementer ++ ?
Definition Decrementer -- ?
Definition If statements ?
If Statement Syntax
Definition While statements
Describe Selection – if and switch using C++.?
Explain Loops – While loop, Do-while loop, for loop.
Explain The break statement