From: "Fredrik Persson" Newsgroups: comp.os.msdos.djgpp References: <8hrgn0$e19$1 AT nnrp1 DOT deja DOT com> <5te05.12211$Za1 DOT 193667 AT newsc DOT telia DOT net> Subject: re: char to string Lines: 45 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: Date: Mon, 12 Jun 2000 16:06:54 GMT NNTP-Posting-Host: 62.20.164.38 X-Complaints-To: abuse AT telia DOT com X-Trace: newsc.telia.net 960826014 62.20.164.38 (Mon, 12 Jun 2000 18:06:54 MET DST) NNTP-Posting-Date: Mon, 12 Jun 2000 18:06:54 MET DST Organization: Telia Internet To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com ok ok i was a little hasty but it isnt so hard.. switch accepts ints and chars so what u have to do if u dont wanna use: if else if and so on.. u just gotta transfer your string into chars possibly an array of chars witch then will be used by the switch command... Chris Mears skrev i diskussionsgruppsmeddelandet:uim3ksca9esukpf6huhdjlbrcrgp004i10 AT 4ax DOT com... > On Fri, 09 Jun 2000 22:46:25 GMT, that hoopy frood Fredrik Persson > scribbled the following: > > >it isnt hard at all u do the same: > > > >string answer; > >switch(answer) > >{ > >case "alt 1": > >cout<<"bla bla"; > >break; > > > >and so on... > > Not quite. > > [...] > switch.cc:9: switch quantity not an integer > switch.cc:10: case label `"alt 1"' does not reduce to an integer > constant > > The switch construct only works with integral types. > > -- > Chris Mears > ICQ: 36697123