C/C++ Program to Count Number of Uppercase and Lowercase Letters in a File

Write a program to count the number of uppercase and lowercase letters ( characters ) in a file in C/C++. For example, Text File Content Hello, My name is John Smith Nice to Meet You Output Uppercase: 7 Lowercase: 28 The logic to count the number of uppercase and lowercase from a file is very … Read more C/C++ Program to Count Number of Uppercase and Lowercase Letters in a File

C/C++ Program to count the number of articles in a string

Write a program to count the number of articles in a string in C/C++. Example, Input An apple a day keeps the doctor away Output Number of “a” = 1 Number of “an” = 1 Number of “the” = 1 There are 3 articles in the English language – “a”, “an” and “the”. The problem … Read more C/C++ Program to count the number of articles in a string

C/C++ Program to count the number of vowels and consonants in a string using pointers

Write a program in C/C++ to count the number of vowels and consonants in a string using pointers. Example, Input MyNameIsJohnSmith Output Consonants: 12 Vowels: 5 Steps Let str[] be the input string. Initialize c1 = 0 and c2 = 0. c1 stores the number of consonants and c2 stores the number of vowels. Read … Read more C/C++ Program to count the number of vowels and consonants in a string using pointers

C Program to count the number of unique characters in a string

Write a program to count the number of distinct characters in a string in C/C++. Example, Input Willingly Output 6 Before we move further, we should know that there is a total of 128 characters in C/C++. Each character is represented by a unique integer value in the range [0, 127]. This numeric value is … Read more C Program to count the number of unique characters in a string

C Program to swap the first and last character of a string

Write a program to swap the first and last character of a string in C. Example, Input: HelloWorld Output: delloWorlH Let str[] be the input string of size n. The first character of str[] is given by str[0]. The last character of str[] is given by str[n-1]. We can find the value of n using … Read more C Program to swap the first and last character of a string