C ++ has no equivalent to the PHP HEREDOC syntax.
You can, however, do this in C ++:
cout << " Menu for program X\n" " 1.Add two numbers\n" " 2.Substract two numbers\n" " 3.Multiply two numbers\n" " Please pick an option from (0-3);" << endl;
Or this is in C:
printf( " Menu for program X\n" " 1.Add two numbers\n" " 2.Substract two numbers\n" " 3.Multiply two numbers\n" " Please pick an option from (0-3);\n" ); fflush(stdout);
Which is directly equivalent to the PHP HEREDOC syntax:
echo <<<EOT Menu for program X 1.Add two numbers 2.Substract two numbers 3.Multiply two numbers Please pick an option from (0-3); EOT;
The above syntax for C and C ++ is processed by the compiler as one long string, stitching them together. It has no other effect on the string literal, therefore, "\ n" is required.
source share