Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: pagnor on Sep 3, 2017



Title: What will be the output of the following code segment after the user enters 0 at the keyboard?int x ...
Post by: pagnor on Sep 3, 2017
What will be the output of the following code segment after the user enters 0 at the keyboard?

   int x = -1;
   cout << "Enter a 0 or a 1 from the keyboard: ";
   cin >> x;
   if (x)
       cout << "true" << endl;
   else
       cout << "false" << endl;

A) true
B) Nothing will be displayed.
C) false
D) x


Title: Re: What will be the output of the following code segment after the user enters 0 at the ...
Post by: bestavinash on Sep 3, 2017
Content hidden