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
How do I write a pseudocode algorithm to read a sequence of number terminated by the number 999 and print the sum of the positiv
Veronika [31]

Answer:Start with the algorithm you are using, and phrase it using words that are easily transcribed into computer instructions.

Indent when you are enclosing instructions within a loop or a conditional clause Avoid words associated with a certain kind of computer language.

Explanation:

5 0
3 years ago
A server needs to connect directly to the Internet. The ipconfig/all command shows that the server has been auto-assigned the IP
Deffense [45]

Answer:

Link-local address

Explanation:

IP addresses that have "FE80" as the hexadecimal representation of their first 10 bits are IPV6 reserved addresses for link-local unicast addressing. These addresses are automatically configured (though may be manually configured too) on any interface and should not be routed. They are used for addressing on a single link with the main aim, among others, of automatic configuration and routing protocol advertisement. Devices attached to this link can be accessed or reached using the link-local addresses as they don't need a global address to communicate.

However, routers will not forward datagram or packets using link-local addresses. In other words, routers are not allowed to connect to the internet using the unicast link-local addresses.

8 0
3 years ago
When should you use an array in developing a program? Explain why it is important to apply arrays in a program.
agasfer [191]

Answer:

The answer is below

Explanation:

There are various reasons to apply arrays in a program. Some of which includes:

1. Arrays provides users to easily save specified numbers of the element in them.

2. It easily store data of similar types and sizes.

3. It allows users to store data in various dimensional arrays.

4. It eliminates deficit of memories for the location of its elements

5 0
3 years ago
Which three are functions of the operating system?
Stels [109]

Answer:

An operating system has three main functions: (1) manage the computer's resources, such as the central processing unit, memory, disk drives, and printers, (2) establish a user interface, and (3) execute and provide services for applications software.

7 0
3 years ago
Read 2 more answers
How can one protect against virus outbreaks in an organization?  What are the common causes of this problems?  How would use add
kobusy [5.1K]

<u>Virus outbreaks in an organization:</u>

In an organization end user who uses the computer or laptop or workstation is not aware of virus outbreaks. So As IT administrator of an organization she/he has aware of latest virus attack and rectification solution before outbreaks.

Common causes for this virus outbreaks problem is update virus definition or database. Update operating system patches on regular basis.

Installation appropriate anti-virus in each workstation or desktop or laptop and scheduling virus scanning and take necessary steps.

To address and troubleshoot disconnect workstation and desktop or laptop from LAN. Uninstalled unnecessary software, delete temp folder contents.

8 0
3 years ago
Other questions:
  • A snail goes up A feet during the day and falls B feet at night. How long does it take him to go up H feet? Given three integer
    8·1 answer
  • OSHA's mission is to: A. Ensure that all workers receive adequate workers' compensation payments B. Esnure that all workers rece
    8·2 answers
  • A typical self-expelling fire extinguisher empties its contents in
    8·1 answer
  • Which of the following correctly orders the investments from LOWER risk to HIGHER risk?
    7·2 answers
  • Which of the following are types of home internet service? Check all that apply
    7·1 answer
  • Help me if you do then you get 10 points and brainliest
    5·1 answer
  • Which window allows you to view and change your computer's system information and settings?
    9·2 answers
  • 20 POINTS AND BRAINLIEST TO CORRECT ANSWER
    15·2 answers
  • What is the function of a bread crumb trial in a website
    11·1 answer
  • What is algorithm and how does it works​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!