Computer Science, asked by Anonymous, 9 months ago

write a program in bluej to input a string and convert into upper case and display count of consecutive characters ​

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;

}

Answered by Anonymous
1

&lt;marquee behavior-move&gt;&lt;font color="blank green"&gt;&lt;h1&gt;like this&lt;/ht&gt;&lt;/marquee&gt;

Attachments:
Similar questions