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 of the following statements is true?
aliya0001 [1]

Answer:

1. Data and information are two terms that can be used interchangeably.

Explanation:

Data is a raw fact, but information is a meaningful term.

Multiple data produce information

Data need to be processed toform information, information is understandable

8 0
3 years ago
Which file system is designed to verify and autocorrect data faults on the volume without having to bring the volume down for ma
Aloiza [94]

Answer: ReFS or Resilient File System.

The ReFS system was actually built from the NTFS (New Technology File System). The ReFS has similar features, but also comes with a built-in scanning system. The ReFS constantly checks your data constantly for corrupted data. The ReFS also supports larger volumes of drives and can support up to 32,768 characters.

6 0
3 years ago
A) What is the maximum value that can be represented as an unsigned n-bit binary integer?
My name is Ann [436]

Answer:

The maximum value that are represented as unsigned n -bit binary integer is 2^n-1. The unsigned binary integer refers to the fixed point of the system that does not contain any fractional digits.

The unsigned binary integer contain module system with the power 2. The number of student table in the class is the best example of the unsigned integer. The numbers can be represented by using the binary notation and bits in the computer system.

5 0
3 years ago
Write a recursive function that takes a non-negative integer as an argument and displays the same number in reverse order (i.e.
avanturin [10]

Answer:

Following are the program in C++ language

#include<iostream> // header file

using namespace std; // namespace std

int reverse(int n1); // function prototype

int main()  // main function()

{

   int num; // Variable declaration

   cout << "Enter the number" << endl;

   cin >> num; // Read the number bu the user

  cout<<"After Reverse the digit:\n";

   int res= reverse(num); // calling function reverse

   

   cout<<res; // display  

}

int reverse(int n1) // function definition of reverse

{

   if (n1<10)  // checking the base condition

       {

           return n1;

       }

   else

       {

           cout << n1 % 10; // Printed the last digit

          return reverse(n1/10); // calling itsself

}

}

Output:

Enter the number:

76538

After Reverse the digit:

83567

Explanation:

Following are the description of the program

  • In the main function read the number by user in the "num" variable of int type.
  • Calling the reverse and pass that "num" variable into it.
  • After calling the control moves to the body of the reverse function.In this function we check the two condition

        1  base condition

   if (n1<10)  // checking the base condition

       {

           return n1;

     }

      2  General condition

  else

       {

           cout << n1 % 10; // Printed the last digit

          return reverse(n1/10); // calling itsself

       }

  • Finally return the reverse number and display them into the main function.
5 0
3 years ago
Importing data is sending data to a new file.Is this true or false
Kipish [7]

false homie I gotcho


3 0
3 years ago
Read 2 more answers
Other questions:
  • What information is not typically included in an e-mail header?​?
    15·1 answer
  • A computer has a word length of 8 bits (including sign). if 2’s complement is used to represent negative numbers, what range of
    5·1 answer
  • Bill downloaded an antivirus software from the Internet. Under the Uniform Commercial Code (UCC), the software is a: Select one:
    15·1 answer
  • Within the Chart Design tab, which section is used to change the data of a previously created chart?
    12·1 answer
  • Write a method called makeLine. The method receives an int parameter that is guaranteed not to be negative and a character. The
    11·1 answer
  • Fedora operating system
    9·1 answer
  • A _____ defines what must take place, not how it will be accomplished.​
    12·1 answer
  • When backing up a database, what is added to the file name?<br> On g metrix
    9·1 answer
  • "You have created a Word document named apple.docx using Microsoft Word. What type of a file is apple.docx ? Select all that app
    14·1 answer
  • What is a circular network.​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!