0
#include "stdafx.h"
#include <iostream>



using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
	char ch;
	
	do{
		cout<<"press Q or q to quit,press any key to continue  :  ";
		cin.get(ch);
		cin.ignore();
		
		if(ch!='Q'&&ch!='q')
			cout<<" you want to continue?\n";

		else
			cout<<"you press q to quit ";
		
		
	}while(ch!='Q'&&ch!='q');
	;

	system("pause>NULL");
	return 0;
}

my prof said that whenever how many the letter i input the output must be just one..
output
press any key to continue : ma.teresa l. sagun
you want to continue?
press any key to continue :
you want to continue?
press any key to continue :
you want to continue?
press any key to continue :
you want to continue?
press any key to continue :
you want to continue?
press any key to continue :
you want to continue?
press any key to continue :

it appears like this..will someone help me..

Edited by Narue: added code tags

6
Contributors
5
Replies
7
Views
6 Years
Discussion Span
Last Post by gyme20
1

you must provide CLEAR details if you want people to help you, what exactly is suppose your code to do?

Votes + Comments
.
0

Looks like the ch.get(ch) takes each of your input character in and execute them one by one. As a result, each character is being checked in the loop.

0

post your question on <link removed>, computer experts will answer your question quickly.

hi, guys
have you solved your problem?

Edited by Narue: Edited spammy link from quote

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.