Post
Topic
Board Games and rounds
Re: じじじ C-Programming Mania 0.001฿ Prize じじじ
by
xHire
on 05/07/2016, 08:00:39 UTC
Hehe, funny task.
Code:
void alex()
{
printf(" 0\r");
}
It simply prints a space for the digit 3 that will be printed later in main() and also prints the zero that is missing to form output "30". "\r" returns carriage to the beginning of the line so that the digit 3 is printed instead of the space.

That doesn't work in Linux console. The carriage return erases the previous characters.
Likewise, alternatively using the "\b" backspace does the same erasing.


If you replace the getch() function, which is from conio.h, by an equivalent function getchar() from stdio.h, you get the result as stated even in Linux console.

At least I didn't need to #include another header file like the accepted solution. Wink