Java To CPP Programs Strings FIXED
Java To CPP Programs Strings FIXED
int main() {
string st1, st2;
cout << "Enter the first string: ";
getline(cin, st1);
cout << "Enter the second string: ";
getline(cin, st2);
if (isAnagram(st1, st2))
cout << "Given words are anagram" << endl;
else
cout << "Given words are not anagram" << endl;
return 0;
}
int main() {
string str;
cout << "Enter the string: ";
getline(cin, str);
transform(str.begin(), str.end(), str.begin(), ::tolower);
Page 1
Java to C++ Converted Programs - Strings
return 0;
}
int main() {
string st1, st2;
int index;
cout << "Enter the First String: ";
cin >> st1;
cout << "Enter the Index: ";
cin >> index;
cout << "Enter the Second String: ";
cin >> st2;
cout << addString(st1, st2, index) << endl;
return 0;
}
Page 2
Java to C++ Converted Programs - Strings
int main() {
string st;
cout << "Enter the string: ";
cin >> st;
if (isPalindrome(st))
cout << "Is Palindrome" << endl;
else
cout << "Not a Palindrome" << endl;
return 0;
}
return wordCount;
}
int main() {
string str;
cout << "Enter the string: ";
getline(cin, str);
int* count = getEvenOddCount(str);
cout << "Number of Even charactered words: " << count[0] << endl;
cout << "Number of Odd charactered words: " << count[1] << endl;
return 0;
}
Page 3
Java to C++ Converted Programs - Strings
return st[index];
}
int main() {
string st;
int index;
cout << "Enter the String: ";
getline(cin, st);
cout << "Enter the index: ";
cin >> index;
return 0;
}
int main() {
string st;
cout << "Enter the string: ";
getline(cin, st);
convertString(st);
return 0;
}
Page 4
Java to C++ Converted Programs - Strings
int main() {
string st;
cout << "Enter the string: ";
getline(cin, st);
int count = getSplCount(st);
cout << "The number of special characters: " << count << endl;
return 0;
}
int main() {
string str;
cout << "Enter the string: ";
getline(cin, str);
string rs = reverseWords(str);
cout << "Reversed String: " << rs << endl;
return 0;
}
Page 5