View Single Post
Old Feb 15th, 2005, 7:43 AM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
There are quite a few problems with this:
    char load[5]; // you need to specify the amount of characters
    char lock[5]; // same with this one

Here's the real problem:
     cin>>load; // this is fine
     cout<<"\n";
     if (load = load) {
This is wrong - it works like this:
if (load == "load")
Unfortunately, because load is an array, you can't do this. What you actually need to do use the strcmp function to compare the two strings:
if (strcmp(load, "load") == 0)
strcmp is a function that compares two strings. It returns 0 when the two strings are equal.

     if (lock = lock) {
The same applies to this.

Enjoy yourself.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote