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.Code: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!!!";
Any help would much be appriciated.




Reply With Quote