Why does this program output 2 x the typed in characters?

It outputs
http://s28.postimg.org/52zudak7x/Untitled.jpg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
#include <conio.h>
int main(void)
{
	char ch;
	printf("Type in characters (Press ENTER to stop): ");
	do
	{
		ch = _getche();
		printf("%c", ch);
	} while (ch != '\r');
	return 0;
}
Last edited on
Each character shows once when you type it in, and once when line 10 outputs it to screen.
Topic archived. No new replies allowed.