#include <stdio.h>
#include <conio.h>

int main(void)
{
char ch;

/* forループ */
ch = getche();
for(; ch != 'q'; )
{
ch = getche(); /* chにqが入力されるまでループを繰り返す */
}
puts("\tqが入力されました");

/* whileループ */
ch = getche();
while(ch != 'q')
{
ch = getche();
}
puts("\tqが入力されました");

/* doループ */
do{
ch =getche(); /* doループだとgetche()はこの一文だけですむ */
}while(ch != 'q');
puts("\tqが入力されました");

return 0;
}