http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Game Help



============================================================
--> WHAT'S THAT?, YOU WANNA MAKE A LIVING ONLINE?
People from all walks of life are becoming wealthy online.
Could YOU do it too? Find out in this free step-by-step guide
to Making a Living Online. (By someone actually doing it!):
http://click.topica.com/caaacfubUrGczbU68iFa/bizweb2000
============================================================


Rob Quill wrote:
> Hi all,
> 
> I intend to write a text-based game. I need to be able to compare 
> multiple 
> inputs so that it is easier for the player. The code is as follows:
> 
> #include <stdio.h>
> #include <string.h>
> 
> char b[20];
> 
> main()
> {
>     printf("You are in a room with a door: ");
>     gets(b);
> 
>     if(b == "open")
>     {
>       printf("You open the door");
>     }
>     else
>     if(b == "open door")
>     {
>       printf("You open the door");
>     }
>     else
>     {
>       printf("Wrong");
>     }
> return 0;
> }
> 
> This does not work for some reason - can someone please suggest a way 
> that 
> will work - preferably the mose efficient way please.
> 
> Thanks,
> Rob.
> 

Hello, perhaps this doesn't help you much, but you could use something 
like basic's instr function, wich tells you if there's a string within 
another. you could also convert all letters to upper case so whenever 
you compare them there will be less chance to make mistakes.

============================================================
Feeling blue about the state of your email inbox? Then
you'll be tickled pink to hear about our free email
organization solution. Learn more at
http://click.topica.com/caaabBybUrGczbU68iFf/register
============================================================

==^================================================================
EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrGcz.bU68iF
Or send an email To: gameprogrammer-unsubscribe@topica.com
This email was sent to: list@pendleton.com

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================