Hi I was wondering what is the shortest way to make string str1 seem equal to string str2
str1 = "Front Space";
str2 = " Front Space";
/*Here is where I'm missing some code to make the strings equal*/
if (str1.compare(str2) == 0) { // They match
cout << "success!!!!" << endl; // This is the output I want
}
All I need it for str1 to equal str2 How can I do it?
I have made multiple attempts but they all don't seem to work correctly. I think it's because of the number of characters in the string, ie: str1 has less characters than str2.
for (int i = 1; i <= str1.length() + 1; i++){
str1[str1.length() - i ] = str1[str1.length() - (i + 1)];
}
Any help appreciated