int main()
{
char j[] = "abc";
print(j);
}
When I define print
like this:
void print(const char *cp)
{
if (cp)
{
while (*cp)
{
int i = *cp;
cout << *cp;
// cout << *cp << endl;
cp++;
}
}
}
The console is something like this (I can not copy the result property, so I use a screenshot) The %
like character is quite expected
However, when I put the endl
the wired %
character disappear
void print(const char *cp)
{
if (cp)
{
while (*cp)
{
int i = *cp;
// cout << *cp;
cout << *cp << endl;
cp++;
}
}
}
Could anyone help explain what happen?
I do not think %
is not part of the prompt
I change my prompt the a text 'a', and the %
still present
Aucun commentaire:
Enregistrer un commentaire