Q:

Write the condition for a while loop that would read ints from the standard input and stop when the value read is equal to 42

0

Write the condition for a while loop that would read ints from the standard input and stop when the value read is equal to 42.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>

int main() {
  int i;
  while (std::cin >> i && i != 42) { /* do something */ }
  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now