C++ Program to Compare Two Strings

This is a C++ Program to Compare Two Given Strings for Equality. Problem Description The program takes two strings and checks for their equality. Problem Solution 1. The program takes two strings. 2. Using string function, the two strings are compared. 3. The result is printed. 4. Exit. C++ Program/Source code Here is the source … Read more

advertisement

C++ Program to Toggle Cases in a String

This is a C++ Program to Toggle Cases in a String. Problem Description The program takes a string and changes the cases of the string characters. Problem Solution 1. The program takes a string. 2. Using ctype functions, uppercase characters are converted to lowercase and vice versa. 3. If entered string is not alphabetical, program … Read more

advertisement

Reverse a String in C++

What is String Reversal? String reversal in C++ is the process of rearranging the characters of a given string in reverse order, changing the original order from end to start. Example: Original String: “programming” Reversed String: “gnimmargorp” Problem Description Write a C++ program that takes a string and reverses it. Problem Solution 1. The program … Read more

advertisement

C++ Program to Implement strncpy() Function

This is a C++ Program to Implement strncpy() Function. Problem Description The program takes a string and copies first ‘n’ characters into another string using the function strncpy(). Problem Solution 1. The program takes a string. 2. The number of characters to copied is taken. 3. Using the string function strcpy(), first n characters are … Read more

advertisement

C++ Program to Count the Number of Vowels/Consonants/Numbers/Special Characters in a String

This is is a C++ Program to Count the Number of Vowels/Consonants/Numbers/Special Characters in a String. Problem Description The program takes a string and counts the number of vowels, consonants, numbers and special characters in the string and prints them. Problem Solution 1. The program takes a string. 2. Using if else condition, the string … Read more

advertisement

C++ Program to Find the Length of a String

This is a C++ Program to Find the Length of a String/Array. Problem Description The program takes a string or an array and prints its length. Problem Solution 1. The program takes a string or an array. 2. Using inbuilt function, the length of the string is found. 3. The result is printed. 4. Exit. … Read more

advertisement

C++ Program to Print All Permutations of a Given String

Method 1: Print all permutations of a given string This C++ Program Permute All Letters of an Input String. It iterates from the 0th letter to the last letter in a string, swaps values and recursively call permute function to print values. The program has input as a string. This prints permutation of all letters … Read more

advertisement

C++ Program to Find the Length of Longest Common Substring

This C++ Program finds Length of Longest Common Substring. Here is source code of the C++ Program to Find Length of Longest Common Substring. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. /* * C++ Program to Find Length of Longest Common Substring */#include<iostream>#include<cstring>using namespace std; // … Read more

advertisement

String Concatenation in C++

What is String concatenation? String concatenation in C++ is the process of combining multiple strings into a single string. It involves merging the characters or contents of two or more strings to create a new concatenated string. For Example, first string = Hello; second string = World Hello + World = Hello World Problem Description … Read more

advertisement

C# Program to Convert Characters of a String to Opposite Case

This C++ Program which changes the case of the given alphabetical character. The program takes a character as an input and exits if the given character is not an alphabet. The case of the given alphabet is changed on the basis of whether the case of given alphabet is lowercase or uppercase. Here is source … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.