When compiling my program in Visual Studio Code using the g++ compiler, the output generated has the %
sign.
#include <iostream>
int Main() {
std::cout << "Hello World!";
return 0;
}
Terminal screenshot:
I have deleted the question mark, so I think there is no control character.
On POSIX compliant systems, individual lines are by convention delimited by a newline character. zsh (which is the shell you’re using) uses %
to indicate output that’s missing that terminating newline character.
Try entering echo -n hello
on your shell to replicate the behaviour.
To fix this (and remove the %
output), add a newline to your code’s output:
…
std::cout << "Hello World!\n";
…