1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
qwelly [4]
3 years ago
12

Given a string, convert the characters of the string into opposite case,i.e. if a character is lower case than convert it into u

pper case and vice versa.
Examples:

Input : geeksForgEeks
Output : GEEKSfORGeEKS

Input : hello every one
Output : HELLO EVERY ONE
Recommended: Please try your approach on {IDE} first, before moving on to the solution.
ASCII values of alphabets: A – Z = 65 to 90, a – z = 97 to 122
Steps:

Take one string of any length and calculate its length.
Scan string character by character and keep checking the index .
If character in a index is in lower case, then subtract 32 to convert it in upper case, else add 32 to convert it in upper case
Print the final string.
Computers and Technology
1 answer:
o-na [289]3 years ago
8 0

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;  

}  

Explanation:

You might be interested in
Which objects appear on the slide after she clicks ok? Check all that apply.
svp [43]

Answer:

A table with sample values

A chart with sample values

Explanation:

4 0
2 years ago
Read 2 more answers
What is the benefit to displaying the merge codes in a document? There is no advantage to showing these codes. The recipient of
IgorC [24]

Answer:

The author will know where data will be inserted in the document.

Explanation:

A method of taking data from a database,  spreadsheet, or other form of structured  data, and inserting it into documents such  as letters, envelopes and/or mailing labels.

5 0
2 years ago
Read 2 more answers
To keep you from inadvertently moving controls as you work in the IDE, click the form or control, then click the _________ optio
Alenkinab [10]

Answer:

Lock controls

Explanation:

4 0
3 years ago
unittttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
alukav5142 [94]
What the hell is the point of this, just to waist people's time?
5 0
3 years ago
What do i need to become a computer technician?
CaHeK987 [17]
Tools battery mah and the display size
5 0
3 years ago
Other questions:
  • Create the strAnalysis() function that takes 1 string argument and returns a string message. The message will be an analysis of
    15·1 answer
  • Can anybody come up with a catchy title for this?
    11·1 answer
  • (I'm sorry that this question isn't school related, I can't find answers anywhere else)
    8·1 answer
  • Dillard’s wants to learn about its consumers' attitudes toward online purchases. There are numerous studies that are available a
    9·1 answer
  • Which precaution should be taken when working inside computer systems??
    9·1 answer
  • Is iPhone better than android
    12·2 answers
  • What is a third variable condition that could create the following correlation?
    10·2 answers
  • Label provides the code that executes if no case label is matched ​
    6·1 answer
  • I used a walmart MoneyCard and now it says its prepaid. Its my dad's card.
    12·1 answer
  • What is the best method to avoid getting spyware on a machine
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!