Q:

Indicate which, if any, of the following output statements are legal

0

Indicate which, if any, of the following output statements are legal:

std::cout << "/*";
std::cout << "*/";
std::cout << /* "*/" */;
std::cout << /* "*/" /* "/*" */;

After you’ve predicted what will happen, test your answers by compiling a
program with each of these statements. Correct any errors you encounter.

All Answers

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

#include <iostream>

int main() {
  std::cout << "/*";  // OK
  std::cout << "*/";  // OK
  std::cout << /* "*/" */;  // Error
  std::cout << /*  "*/" /*  "/*"  */;  // OK
  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