C++ Program to Check whether two Strings are Anagrams

This is a C++ Program to Find if Two Strings are Anagrams. Problem Description The program takes two strings and checks if they are anagrams. An anagram is a phrase formed by rearranging the letters of a different phrase. Problem Solution 1. The program takes two strings. 2. Using a function, the two strings are … Read more

advertisement

C++ Program to Find Frequency and Position of Characters in a String

This is a C++ Program to Print Each Letter in a String followed by its Frequency. Problem Description The program takes a string and prints the frequency of each letter in the string. Problem Solution 1. The program takes a string. 2. The number of times a letter occurs in the string is recorded. 3. … Read more

advertisement

C++ Program to Remove Spaces from a String

This is a C++ Program to Remove the Spaces in a String. Problem Description The program takes a string and removes the spaces in it. Problem Solution 1. The program takes a string. 2. Using a for loop, any spaces found in the string are removed. 3. The result is printed. 4. Exit. C++ Program/Source … Read more

advertisement

C++ Program to Replace All Spaces in a String with %

This is a C++ Program to Replace all Spaces in a String with %. Problem Description The program takes a string and replaces all spaces in it with %. Problem Solution 1. The program takes a string. 2. The string is checked for spaces and replaced with %. 3. The result is printed. 4. Exit. … Read more

advertisement

C++ Program to Implement strchr() Function

This is a C++ Program to Implement the strchr() Function. Problem Description The program implements the function strchr() which takes a string and a character and returns a pointer to location of the latter in the string. Problem Solution 1. The program takes a string and a character. 2. Using a for loop, the character … Read more

advertisement

C++ Program to Implement strspn() Function

This is a C++ Program to Implement the strspn() Function. Problem Description The program implements the function strspn() which takes two strings and returns the length of portion of first string consisting of characters only from second string. Problem Solution 1. The program takes two strings. 2. Using for loops, both strings are compared. 3. … Read more

advertisement

C++ Program to Implement strpbrk() Function

This is a C++ Program to Implement strpbrk() Function. Problem Description The program implements the function strpbrk() which takes two strings and returns a pointer if a string is found in another string. Problem Solution 1. The program takes two strings. 2. Using a for loop, the two strings are compared for same characters. 3. … Read more

advertisement

C++ Program to Implement strncmp() Function

This is a C++ Program to Implement strncmp() Function. Problem Description The program implements the function strncmp() which compares first ‘n’ characters of two strings. Problem Solution 1. The program takes two strings. 2. Using a for loop, first n characters of the strings are compared. 3. The result is printed accordingly. 4. Exit. C++ … Read more

advertisement

C++ Program to Count Number of Words in a String

This is a C++ Program to Find the Number of Words in a Given Sentence. Problem Description The program takes a string and counts the number of words in it. Problem Solution 1. The program takes a string. 2. Using a for loop, the number of spaces in the string are counted. 3. The total … Read more

advertisement

C++ Program to Find the Sum of ASCII Value of All Characters in the String

This is a C++ Program to Find the Sum of ASCII Value of all Elements in a String. Problem Description The program takes a string and prints the sum ASCII values of all the characters. Problem Solution 1. The program takes a string. 2. Using a for loop, the ASCII equivalent of each character is … 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.