Jump to content


Photo

C++ question


  • Please log in to reply
4 replies to this topic

#1 jakevfr

jakevfr

    Young Padawan

  • Members
  • Pip
  • 40 posts

Posted 11 June 2006 - 03:24 PM

How do you do if then statements with characters? I've tried google and this site as well as the search but I can't find out how to do it...

This is what I'm trying
if ( name == 'Jay' ) {
//code here
}
If you would use this code to help me that would be great :)

And if you spend 2 seconds searching somewhere I apologize but I did in fact look

#2 DanWilliamson

DanWilliamson

    P2L Jedi

  • Members
  • PipPipPip
  • 651 posts

Posted 11 June 2006 - 04:42 PM

I'm not even going to pretend I know what i'm talking about but could it be the same as Javascript?

if (name == Jay)
{
// Code
}


#3 Matthew.

Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 11 June 2006 - 05:28 PM

http://www.cs.xu.edu...nditionals.html

Thats from a quick google :)

#4 PSgirl

PSgirl

    P2L Staff

  • P2L Staff
  • PipPipPipPip
  • 2,056 posts
  • Gender:Female

Posted 11 June 2006 - 05:52 PM

.Matt I think he already understand how conditional works, but he has trouble with comparing strings. I think :)

jakevfr - Have you declared 'name' as a string or as a array of chars?
Take a look here:
http://www.cprogramm...al/lesson9.html

#5 jakevfr

jakevfr

    Young Padawan

  • Members
  • Pip
  • 40 posts

Posted 11 June 2006 - 06:15 PM

That's where I was going to for how to compare things... I just saw the link to C++ strings so thanks everyone. :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users