Home > Back-end >  Help!!!!!! With STD: : cin as a condition of cycle of judgment and execution order is
Help!!!!!! With STD: : cin as a condition of cycle of judgment and execution order is

Time:05-12

Newbie on the road, meet you
#include
Int main () {
int i;
While (STD: : cin> I) {
STD: : cout}

This code, the while loop is to first read all save data stream to perform again in cin STD: : cout operation or read in a data performs a loop body?
While statement execution order is to judge whether the conditions of the parentheses is true, if it is true, perform loop body; If it is false, then the end of cycle, so at this time through the while (STD: : cin> I) enter the multiple values, such as: 1, 2, 3, 4, j, is when the input 1 judgment is true, then execute the STD: : cout
And this question is more difficult to understand in a for loop,
We need the value of user input to initialization, is for (STD: : cin> i; I<100 & amp; I> 0;) Initialization, and for the execution of the order first, and then determine whether a condition is true, if is true the execution of the loop body, and then execute the for the last expression, but still found during testing can enter multiple values, and get the result of the loop body, but logically should not initialized only once?
For (STD: : cin> i; I<100 & amp; I> 0;) {
STD: : cout}

So, STD: : cin> I in the loop structure what on earth is executed in the order, looking forward to the great god answers, I appreciate,
In addition, I have just started learning c + +, using the simplest GCC + DOS command interpreter, still hope the great god can use plain language and examples to the younger brother problem and, thank you very much
  • Related