1. Write a program to find the length of string. solution
2. Write a program to display string from backward. solution
3. Write a program to count number of words in string. solution
4. Write a program to concatenate one string contents to another. solution
5. Write a program to compare two strings they are exact equal or not. solution
6. Write a program to check a string is palindrome or not. solution
7. Write a program to find a substring within a string. If found display its starting position. solution
8. Write a program to reverse a string. solution
9. Write a program to convert a string in lowercase. solution
10. Write a program to convert a string in uppercase. solution
11. Write the output of the following program. Assume that all necessary header files are included.
void Encrypt(char T[]) { for (int i = 0; T[i] != '\0'; i += 2) if (T[i] == 'A' || T[i] == 'E') T[i] = '#'; else if (islower(T[i])) T[i] = toupper(T[i]); else T[i] = '@'; } int main() { char text[]="SaVE EArtH"; Encrypt(text); cout << text << endl; return 0; }
12. Write the output of the following program
int main() { char name[] = "CoMPutER"; for (int x = 0; x < strlen(name); x++) if (islower(name [x])) name [x] = toupper(name[x]); else if (isupper(name[x])) if (x % 2 == 0) name[x] = tolower(name[x]); else name[x] = name[x-1]; cout << name; return 0; }