Question: C++ Complete function string_pals for this program function string_pals: bool string_pals(string B, string B) { return true; } Description Given the provided C++ program complete
Description Given the provided C++ program complete the function string pals such that given two strings A and B of lowercase letters. It returns true If you can swap two letters in A so the result is equal to B, otherwise, It returns false. Swapping letters is defined as taking two Indices I and I (0-Indexed) such that I l 1 and swapping the characters at All] and All. For example, swapping at Indices 0 and 2 in "abcd" results in "cbad". Listing 1: program driver main function 1 int main() 21 3 string : 4 string B 5 char user_input- 6 do 7 { 8 cout > A 10 cout > B 12 13 string outcome - string_pals(A, B) ? "palsts not pals": 14 cout > user_input: 18 while (user_input ty' || user_input 'Y); 19 20 cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
