X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Sun, 30 Nov 2003 19:08:19 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-Id: <3405-Sun30Nov2003190818+0200-eliz@elta.co.il> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: (cmad_x AT yahoo DOT com) Subject: Re: C/C++ switch statement question References: Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: cmad_x AT yahoo DOT com (Chris Mantoulidis) > Newsgroups: comp.os.msdos.djgpp > Date: 30 Nov 2003 08:40:03 -0800 > > string s; > cin >> s; > switch (s) > { > ....... > } > > but i get an error saying "switch quantity not an integer"... probably > the switch needs an integer parameter and probably that's the same > with C (and a char * in the example). > > so... there is no way that i can use switch for a string? > > i have to use IF-ELSE??? Right. C and C++ cannot compare strings except by calling functions (such as strcmp).