hlchuah77
October 9th, 2005, 05:47 PM
string myStrArray[10];
for(int i = 0; i < 10; ++i)
{
myStrArray[i] = "a";
}
string myString;
cin>>myString; // input myString = "a"
char charStr1[] = myStrArray[0];
char charStr2[] = myString;
if(strcmp(charStr1, charStr2) == 0)
cout<<"Same!!!";
When I try the code above, it was an error. I have already changed the string variable to char array, but somehow it still does not work.
Any help would much be appriciated.
for(int i = 0; i < 10; ++i)
{
myStrArray[i] = "a";
}
string myString;
cin>>myString; // input myString = "a"
char charStr1[] = myStrArray[0];
char charStr2[] = myString;
if(strcmp(charStr1, charStr2) == 0)
cout<<"Same!!!";
When I try the code above, it was an error. I have already changed the string variable to char array, but somehow it still does not work.
Any help would much be appriciated.