![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: May 2006
Posts: 51
Rep Power: 3
![]() |
comparison between pointer and integer
hi, just a quick one, im just learning c++ at the moment.
How can i do this: std::cout << "Would you like to continue? (Y/N)" << endl;
char menu;
std::cin >> menu;
if((menu == "y") || (menu == "Y"))
{
cout << " " << endl;
}all im trying to do is allow a user to say yes they want to continue.. what is wrong with the above ? the error i get: error:ISO C++ forbids comparison between pointer and integer error:ISO C++ forbids comparison between pointer and integer
__________________
AMD Athlon X2 4200+ -- Asus V3-M2V890 -- 2GB Kingston -- Vista Ultimate 32bit + Ubuntu 8.04 Intel C2D T5870 2.0GHZ -- Vostro 1510 -- 2048MB -- Windows XP SP2 ASCII stupid question, get a stupid ANSI ! |
|
|
|
|
|
#2 |
|
Game engine designer
Join Date: May 2005
Location: Sweden
Posts: 301
Rep Power: 4
![]() |
Try using 'y' in stead of "y".
__________________
http://www.klarre.se |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Dec 2005
Posts: 67
Rep Power: 0
![]() |
You need the single ' around the Y and y instead of ".
|
|
|
|
|
|
#4 |
|
Programmer
Join Date: Dec 2005
Posts: 67
Rep Power: 0
![]() |
|
|
|
|
|
|
#5 |
|
Programmer
Join Date: May 2006
Posts: 51
Rep Power: 3
![]() |
ok thanks for that people !
__________________
AMD Athlon X2 4200+ -- Asus V3-M2V890 -- 2GB Kingston -- Vista Ultimate 32bit + Ubuntu 8.04 Intel C2D T5870 2.0GHZ -- Vostro 1510 -- 2048MB -- Windows XP SP2 ASCII stupid question, get a stupid ANSI ! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Update IdTCPSDerver in a DLL | sggaunt | Delphi | 0 | Mar 13th, 2007 11:56 AM |
| relation between array and pointer | n00b | C++ | 6 | Oct 12th, 2006 3:38 PM |
| string pointer problem | codylee270 | C | 17 | Jan 18th, 2006 6:31 PM |
| HELP please!!! | hamacacolgante | C | 7 | Nov 21st, 2005 5:36 AM |
| Pointers in C (Part I) | Stack Overflow | C | 4 | Apr 28th, 2005 7:03 PM |