60.6k views
1 vote
Write a program which capitalize every character after full stopin a given sentence

User Vickey
by
5.6k points

1 Answer

4 votes

Answer:

#include <bits/stdc++.h>//header file which includes most of the libraries..

using namespace std;

int main() {

char st[500];//character array of length 500..

cin.getline(st,499);//taking input of the text.

for(int i=0;st[i];i++)

{

if((st[i]=='.')&& (i!=strlen(st)-1))//condition

{

st[i+1]= toupper(st[i+1]);//converting to upper case.

}

}

cout<<st<<endl;//printing the string..

return 0;

}

Input:

i am .the .great .gambler.i am going gamble everything

Output:

i am .The .Great .Gambler.I am going gamble everything

Step-by-step explanation:

I have taken a character array of size 500.

Taking input as a line.

If full stop encounters then converting the character to uppercase if it exists.

Printing the output.

User Neverwalkaloner
by
6.3k points