Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 26th, 2007, 5:25 PM   #1
teishu
Programmer
 
Join Date: May 2006
Posts: 51
Rep Power: 3 teishu is on a distinguished road
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 !
teishu is offline   Reply With Quote
Old Jun 26th, 2007, 5:45 PM   #2
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 301
Rep Power: 4 Klarre is on a distinguished road
Try using 'y' in stead of "y".
__________________
http://www.klarre.se
Klarre is offline   Reply With Quote
Old Jun 26th, 2007, 5:51 PM   #3
MicDareall
Programmer
 
Join Date: Dec 2005
Posts: 67
Rep Power: 0 MicDareall is an unknown quantity at this point
You need the single ' around the Y and y instead of ".
MicDareall is offline   Reply With Quote
Old Jun 26th, 2007, 5:51 PM   #4
MicDareall
Programmer
 
Join Date: Dec 2005
Posts: 67
Rep Power: 0 MicDareall is an unknown quantity at this point
Quote:
Originally Posted by Klarre View Post
Try using 'y' in stead of "y".
lol you beat me to it.
MicDareall is offline   Reply With Quote
Old Jun 26th, 2007, 7:33 PM   #5
teishu
Programmer
 
Join Date: May 2006
Posts: 51
Rep Power: 3 teishu is on a distinguished road
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 !
teishu is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:18 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC