Question #185981

Insert the missing condition in the following code fragment. The code is intended to compute the product of several integers entered by the user. The loop should stop when the user enters something other than an integer.

int product = 1;

int value;

cin >> value; while (______ )

{

product = product * value;

cin >> value;

}


Expert's answer

while (typeid(value).name()==typeid(int).name()) 

This also requires #include <typeinfo> before int main().


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS