Reputation: 520
Everytime I use the terminal to print out a string or any kind of character, it automatically prints an "%" at the end of each line. This happens everytime I try to print something from C++ or php, havent tried other languages yet. I think it might be something with vscode, and have no idea how it came or how to fix it.
#include <iostream>
using namespace std;
int test = 2;
int main()
{
if(test < 9999){
test = 1;
}
cout << test;
}
Output:
musti@my-mbp clus % g++ main.cpp -o tests && ./tests
1%
Also changing the cout from cout << test;
to cout << test << endl;
Removes the % from the output.
Upvotes: 1
Views: 2429
Reputation: 177
Are you using zsh? A line without endl
is considered a "partial line", so zsh shows a color-inverted %
then goes to the next line.
When a partial line is preserved, by default you will see an inverse+bold character at the end of the partial line: a ‘%’ for a normal user or a ‘#’ for root. If set, the shell parameter PROMPT_EOL_MARK can be used to customize how the end of partial lines are shown.
More information is available in their docs.
Upvotes: 5