Computer Science, asked by vrushika12, 7 months ago

Write a Java program to input a sentence and convert into lowercase and display the total number of words staring with a letter 'a'. Sample Input: ADVANCEMENT AND APPLICATION OF INFORMATION TECHNOLOGY ARE EVER CHANGING Sample Output: The total number of words starting with a letter 'a' is 4 Correct answer will be brainliest wrong answer will surely be reported guys plz answer correctly

Answers

Answered by Anonymous
1

Answer:

// CPP program to Convert characters

// of a string to opposite case

#include<iostream>

using namespace std;

// Function to convert characters

// of a string to opposite case

void convertOpposite(string &str)

{

int ln = str.length();

// Conversion according to ASCII values

for (int i=0; i<ln; i++)

{

if (str[i]>='a' && str[i]<='z')

//Convert lowercase to uppercase

str[i] = str[i] - 32;

else if(str[i]>='A' && str[i]<='Z')

//Convert uppercase to lowercase

str[i] = str[i] + 32;

}

}

// Driver function

int main()

{

string str = "GeEkSfOrGeEkS";

// Calling the Function

convertOpposite(str);

cout << str;

return 0;

}

Similar questions