Write a program with the following functions: char lastday[] = \"THE Last Day of
ID: 3642346 • Letter: W
Question
Write a program with the following functions:char lastday[] = "THE Last Day of SCHOOL";
Write a function called number_of_uppercase which computes and returns under its name the number of uppercase letters in a string that is its only parameter.
int isupper(int c) returns nonzero if c is an uppercase letter; returns 0 otherwise
if (isupper(lastday[k]) != 0)
{
cout << buffer[k] << " ";
numofcapital++;
}
Write a function called character_count with two parameters, a string and a character, which determines and returns under its name the number of occurrences of the character in the given string. Prompt user for character to count.
Explanation / Answer
#include<iostream>
using namespace std;
int number_of_uppercase(char lastday[], int size)
{
int numofcapital = 0;
for(int i =0; i<size; i++)
if (isupper(lastday[i]) != 0)
{
cout << buffer[i] << " ";
numofcapital++;
}
return numofcapital;
}
int main()
{
char lastday[] = "THE Last Day of SCHOOL";
cout << number_of_uppercase(lastday, 22) << endl;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.