I am trying to make a program that needs to compare a string. here is a basic program of what i mean, i want it to say "it worked" but it seems to only read as not true. anyone know how to do this? thanx for any help.
#include <iostream>
#include <conio>
#pragma hdrstop
#include <condefs.h>
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char **argv)
{
char *name = new char [100];
cout << "the word is silver (all lower case)." << endl;
cout << "enter name:";
cin >> name;
if (name == "silver") {
cout << "it worked." << endl;
}
else if (name != "silver"){
cout << "it didn't work." << endl;
}
cout << name;
getch();
return 0;
}