View Single Post
Old Feb 15th, 2005, 3:59 AM   #3
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
2 things i see wrong with the code to start with, when comparing things in a if statment use == not singal = as singla is an assignment operator and so will asign the value of lock to lock and always evaluates to true, but then again

if (lock == lock )

will always be true as you are comparing the same variable to each other.

change the code thus i think (might need to be corrected...)

if (load.Equals("load")) {//comparing a string to a string
         shotgun.drawn(); }
     cout<<"Then you would have to lock it, type in lock.\n";
     cin>>lock;
     if (lock.Equals("lock")) {//String comparison again(not sure if the command Equals is correct though.
         shotgun.locked(); }
Berto is offline   Reply With Quote