Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   problem... help please (http://www.go4expert.com/forums/problem-help-please-t3838/)

noob2007 12Apr2007 12:41

problem... help please
the code below works fine but there is a few problems
it displays:
please enter the character you want:
The character you have entered is translated into a '' but you also have decided to exit the program

THis is not suppose 2 happen. it SUPPOSe to ask you to enter the space character then it displays teh converted character. then if teh user enter ' . 'then it will display the message and you will exit

im new to C++
this is my code:


case 2: //character 'space' condition
cout << "\n Note: Enter '.'(i.e. dot, full stop or decimal point) to exit\n\n";

while (ch != '.')

cout << "Please enter the character you want: ";
ch = cin.get();

switch (ch)
case ' ':
cout << "\nThe character you have entered is translated into a '_' (underscore)"<< endl << "\n";

cout << "\nThe character you have entered is translated into a " << "'" << ch << "'" << "but you also have decided";
cout << " to exit the program...\n\n";


shabbir 12Apr2007 15:05

Re: problem... help please
You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum.

Also try reading Before you make a query thread and specifically have a better topic so it helps all of us including the person searching

noob2007 12Apr2007 16:20

Re: problem... help please
oh srry

DaWei 12Apr2007 18:10

Re: problem... help please
The ENTER key is not a space, but it is a character, therefore the default path in the switch is taken and the program exits.

All times are GMT +5.5. The time now is 09:15.