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
Determining Correct Date Function What function text would you use to put today's date and time in a cell? 0 =TODAYO =NOWO O NOW
Murrr4er [49]

Current date formula:

=TODAY()

Current time formula:

=NOW()

As you can see, the =TODAY() formula only includes the day, month and year. The =NOW() function displays more information, showing the day, month, year, hour and minutes (using a 24-hour clock)

if useful mark as brainliest

3 0
3 years ago
Question # 2 Multiple Choice The _____ method returns an integer between the two provided numbers. It can take the value of eith
nlexa [21]

Answer:

randint

Explanation:

7 0
3 years ago
Read 2 more answers
Características que debe tener un módulo o kit tecnológico para aprender​
12345 [234]

Answer:

Multi herramientas

Explanation:

Un kit tecnologico debe contener todas las herramientas necesarias para el trabajo que lo necesites, por ejemplo destornillador magnetico con varias puntas, herramientas para desmontar y por supuesto tener buena claridad para trabajar y alcohol isoprofilico de al menos 90+ para limpiar electronicos.

5 0
2 years ago
Which of the following is an example of a runtime error?
Rina8888 [55]

Answer:

missing quotation marks around a string literal

6 0
2 years ago
Why can't we sign up to brainly.com??????????????????
LiRa [457]

Answer:

Explanation:

so why are you doing sign up

8 0
3 years ago
Other questions:
  • Kim is creating a one-page presentation in Word about her parents’ home country, Vietnam. She has inserted images that are each
    7·2 answers
  • The following is true about SPAM ________.
    9·1 answer
  • When using the “reply all” option, your message will automatically be sent to ____ recipients of the original message. ​?
    7·2 answers
  • in what way do rules and laws created to address public problems affect individuals groups and business
    13·1 answer
  • Can your computer become infected with a virus via email
    10·1 answer
  • Explain the SCAN disk scheduling algorithm. Explain why it is sometimes called the Elevator Algorithm.
    9·1 answer
  • What is the meaning of delegation
    13·2 answers
  • anyone got a class named computer literacy? or sum similar to using Microsoft programs? i need a lotttt of help, im 3 units behi
    12·2 answers
  • Open the NetBeans IDE and create a new project named MySizes.java. Your program should do the following:
    9·1 answer
  • What instructions would a computer have the hardest time completing correctly
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!