Write a program with three functions: upper , lower , and reverse . The upper function should accept a pointer to a C-string as it's only argument. It should step through each character in the string, converting it to uppercase. The lower function, too, should accept a pointer to a C-string as it's only argument. It should step through each character in the string, converting it to lowercase. Like upper and lower , reverse should also accept a pointer to a string as it's only argument. As it steps through the string, it should test each character to determine whether it is upper- or lowercase. If a character is uppercase, it should be converted to lowercase. Likewise, if a character is lowercase, it should be converted to uppercase. Test the functions by asking for a string in function main , then passing it to them in the following order: reverse, lower , and upper. Main will then print out the strings to demonstrate the functions worked. Each function accepts exactly one argument. None of the functions return anything. None of the functions (other than main) interacts with the user in anyway. Variables of type string are not allowed.

Answers

Answer 1

Answer:

Here is the C++ program:

#include <iostream>  //to use input output functions

#include <cstring>  //to manipulate C-strings

#include <string>  //to manipulate strings

using namespace std;  //to access objects cin cout

//function prototypes

void upper(char *);  to convert to upper case

void lower(char *);  //to convert to lower case

void reverse(char *);  //to convert to reverse case

int main() {  //start of main method

   char input[101];  //creates a char type array to hold input string

   cout << "Enter a string: ";  //prompts user to enter a string

   cin.getline(input, 101);  //reads input string from user

   upper(input);  //calls upper() method to convert the string to upper case

   lower(input);  //calls lower() method to convert the string to lower case

   reverse(input); } //calls reverse() method to convert the string to reverse case

void upper(char *cString){  //method that takes a pointer to a C-string as it's only argument and converts that string to upper case

   cout << "String in upper case: ";  //displays string in upper case

   for(int i = 0; i < strlen(cString); i++){  //iterates through the input string cString until the length of the cString is reached

       if(islower(cString[i]))  //checks if the character at i-th index of cString is in lower case

           cout << (char) toupper(cString[i]);  //converts each i-th character of cString to upper case at each iteration

       else  //if no character of cString is in lower case

           cout << cString[i];    }  //displays the cString as it is

   cout << endl;}  //prints a new line

void lower(char *cString){  //method that takes a pointer to a C-string as it's only argument and converts that string to lower case

   cout << "String in lower case: "; //displays string in lower case

   for(int i = 0; i < strlen(cString); i++){  //iterates through each character using for loop  first character to last

       if(isupper(cString[i]))  //checks if the character at i-th index of cString is in upper case

           cout << (char) tolower(cString[i]);  //converts each i-th character of cString to lower case at each iteration

       else  //if no character of cString is in upper case

           cout << cString[i];    }  //displays the cString as it is

           cout << endl; }  //prints a new line

void reverse(char *cString){  //method that takes a pointer to a C-string as it's only argument and converts that string to reverse case (upper to lower and vice versa)

   cout << "String in reverse case: ";  //displays string in reverse case

   for(int i = 0; i < strlen(cString); i++){  //iterates through each character using for loop  first character to last

       if(isupper(cString[i]))  //checks if the character at i-th index of cString is in upper case

           cout << (char) tolower(cString[i]);  //converts character at i-th position of cString to lower

       else  //if the character is in lower case

           cout << (char) toupper(cString[i]);    }  //converts character at i-th position of cString to upper

   cout << endl;}  //prints a new line

 

Explanation:

I will explain the program with an example.

Lets suppose user enters "hi" as input. So

Now first upper() method is called by passing this C-string to it.

It has a for loop that checks at each iteration, if a character of C-string is in lower using islower method which returns true if the character is in lower case. Since both the characters 'h' and 'i' are in lower in case so they are converted to upper case at each iteration using toupper() method. So the output of this part is:

String in upper case: HI

Now next lower() method is called by passing this C-string to it.

It has a for loop that checks at each iteration, if a character of C-string is in upper using isupper method which returns true if the character is in upper case. Since both the characters 'h' and 'i' are in lower in case so the string remains as it is. So the output of this part is:

String in lower case: hi

Now next reverse() method is called by passing this C-string to it.

It has a for loop that checks at each iteration, if a character of C-string is in upper using isupper method which returns true if the character is in upper case. Since both the characters 'h' and 'i' are in lower so else part: cout << (char) toupper(cString[i]); executes which converts these characters to upper case (reverse case). So the output of this part is:

String in reverse case: HI

The screenshot of program output with a different example is attached.

Write A Program With Three Functions: Upper , Lower , And Reverse . The Upper Function Should Accept

Related Questions

If you are wanting to change programs, when do you need to make this request?
a.To change programs, you must contact your advisor or counselor and complete the change of program application during an open application window.
b.You can change at any time; just email your advisor regarding the change.
c.You can never change programs.
d.You do not need to notify anyone. You just need to start taking courses for the desired program.

Answers

Answer:

If your discussing colleges and degrees, you cant take courses your not autorized to take.

So if you have one major and wish to change to another then you need to discuss with a student advisor or counseler so they can make the changes. They will also discuss which classes are necessary for your program of choosing, making sure all your requirements are completed.

Explanation:

Please answer this please solve it

Answers

Answer:

If you still can't figure it out look this up

nvcc cafe problem

Explanation:

The CPU is located on what part of the computer?

the motherboard

the system bus

the random access memory

the hard drive

Answers

Answer:

the motherboard

Explanation:

The answer for this question is the first one.

Consider the GBN protocol with a sender window size of 4 and a sequence number range of 1,024. Suppose that at time t, the next in-order packet that the receiver is expecting has a sequence number of k. Assume that the medium does not reorder messages. Answer the following questions: What are the possible sets of sequence numbers inside the sender’s window at time t? Justify your answer. What are all possible values of the ACK field in all possible messages currently propagating back to the sender at time t? Justify your answer.

Answers

Answer:

Follows are the solution to this question:

Explanation:

In point a:

N = Size of window = 4

Sequence Number Set = 1,024

Case No. 1:

Presume the receiver is k, and all k-1 packets were known. A window for the sender would be within the range of [k, k+N-1] Numbers in order

Case No. 2:

If the sender's window occurs within the set of sequence numbers [k-N, k-1]. The sender's window would be in the context of the sequence numbers [k-N, k-1]. Consequently, its potential sets of sequence numbers within the transmitter window are in the range [k-N: k] at time t.

In point b:

In the area for an acknowledgment (ACK) would be [k-N, k-1], in which the sender sent less ACK to all k-N packets than the n-N-1 ACK. Therefore, in all communications, both possible values of the ACK field currently vary between k-N-1 and k-1.

What is the name of the file in which this
program is stored: public class myProgram
A. myProgram.class
B. myProgram.java
C. myProgram.jgrasp
D. myProgram.doc

Answers

Answer:

B

Explanation:

i’m an information technology  student and as I remember we used this  name

Submit your design an informative computer safety brochure for a specific cybercrime that targets an audience of your choice.

Answers

USE SOCRACTIC IT WOULD DEFINITELY HELP ANSWER THIS QUESTION Try it

What is Naptha used for?

Answers

Answer:

Naphtha is used to dilute heavy crude oil to reduce its viscosity and enable/facilitate transport; undiluted heavy crude cannot normally be transported by pipeline, and may also be difficult to pump onto oil tankers. Other common dilutants include natural-gas condensate, and light crude.

Answer:

Naphtha is used for laundry soaps and clearing fluids

High Hopes^^

Barry-

How would an assignee enter details, such as mileage and billing information, for a task?

Create a new task, and enter the details.
Open the status report, and enter the details.
In the main task window, click the Details button.
Within the assigned task window, scroll to the bottom.

Answers

Answer:

It's C

Explanation:

On edg

Answer:

C is correct

Explanation:

I got it on edg

Which tool did Adnan use to modify the image?

rotation handle
left sizing handle
top sizing handle
corner sizing handle

Answers

Answer:

D

Explanation:

Answer:

corner sizing handle

Explanation:

You can copy and paste ________ from excel to powerpoint

Answers

Answer: data

Explanation:

Your answer is:data

Kim frequently saves her PowerPoint files in a different format. So, she decides to add a command for this action to the Quick Access Toolbar. Complete the steps to follow for this task.

1. Select a drop-down menu at the top of the screen.

2. Choose
from the Customize Quick Access Toolbar list.

3. A Quick Access Toolbar dialog box opens.

4. In the
section, select
.

5. Choose Save As Other Format.

6. Click the
button, and click OK.

Answers

Answer:

More Commands, Choose Commands from, All commands, Add

Explanation:

Correct on Edg

More Commands, Choose Commands from, All commands.

What is Commands?

One form of statement that tells someone what to do is a command. Additional sentence types include inquiries, exclamations, and declarations.

Usually, but not always, command phrases begin with an imperative (bossy) verb because they demand that the subject take an action.

Children should first learn about and be able to recognize the word classes noun, verb, adjective, and adverb before being taught commands. They can start working on instructions and the usage of imperative verbs after they are familiar with these.

Therefore, More Commands, Choose Commands from, All commands.

To learn more about Commands, refer to the link:

https://brainly.com/question/30319932

#SPJ3

Steven wrote an algorithm for his coding class that explains how he makes a cake. Which is the correct sequence of steps that he used?

Mix the ingredients, put into the oven, preheat the oven
Preheat the oven, mix the ingredients, put into oven
Preheat the oven, put into the oven, mix the ingredients
Put into the oven, mix the ingredients, preheat the oven


WILL GIVE ALOT OF POINTS "29" TOTAL

Answers

Answer:

Preheat the oven, mix the ingredients, put into oven.

Answer:

Preheat oven, mix the ingredients, put into oven

Explanation:

basically its B

:)

Which filter allows you to impart a stamping or raising effect in an image?

A. Stylize filter
B. Noise filter
C. Sharpen filter
D. Blur filter
E. Texture filter

Answers

Answer:

A. Stylize filter

Explanation:

I took the test on edmentum your welcome.

Answer:

Is B because noisse feltrr✔️

Gloria is adding footers to a PowerPoint template for students to use in a literature class. Each student must choose an author and make a presentation about their life and work. She wants the first slide in each presentation to show only the author’s name and photo. On subsequent slides, she wants to include a footer with a date and time that changes depending on the actual date of each presentation.

To insert the footer according to her plan, what must Gloria click in the Header & Footer dialog box?

Fixed
Preview
Slide number
Don’t show on title slide

Answers

Answer:

Its D

Explanation:

On edg

Answer: don’t show on title slide

Explanation:

Finally, Su uses the last slide of her presentation as a summary slide. She wants to make sure the text she types automatically fits into the text box without changing the text box.

Which tool can Su use to accomplish this task?

Under which heading is the autofit feature found?

Which option should Su choose?

Answers

Answer:

Format Shape pane

Text Options

Shrink text on overflow

Explanation:

Answer:

Format Shape pane

Text Options

Shrink text on overflow

Explanation:

100%

Which IEEE standards define Wi-Fi technology?

network standards

802.11 standards

111.82 standards

fidelity standards

Answers

Answer:

802.11 standards

the answer is:

b. 802.11 standards

You are allowed to use up to 5 images from one artist or photographer without
violating Copyright laws

Answers

If it’s a true or false question, then I think it’s false because I’m pretty sure you have to give credit.

Bluetooth's pan are also known as______.​

Answers

Answer:

personal area network..??

Explanation:

What output is produced by
this code?
System.out.print("Computing\nisInfun");
A. Computing is fun
B. Computing\nis\nfun
C.
Computing
is
fun
D. This code will not produce any output, it contains an error.

Answers

Answer:

The answer to this question is given below in the explanation section. the correct option is C.

Explanation:

This is Java code statement:

System.out.print("Computing\nisInfun");

The output of this code statement is

Computing

isInfun

However, it is noted that the C option is not written correctly, but it is guessed that it will match to option C.

This Java code statement first prints "Computing" and then on the next line it will print "isInfun" because after the word "Computing" there is a line terminator i.e. \n. when \n will appear, the compiler prints the remaining text in the statement on the next line.

Write your code to define and use two functions. The Get User Values function reads in num Values integers from the input and assigns to user Values. The Output Ints Less Than Or Equal To Threshold function outputs all integers in user Values that are less than or equal to maxVal. num Values indicates the number of integers in user Values. void Get User Values(int user Values[], int num Values) void Output Ints Less Than Or Equal To Threshold (int user Values[], int maxVal, int num Values)

Answers

Answer:

#include <iostream>

#include <vector>

using namespace std;

/* Define your function here */

vector<int> GetUserValues(vector<int>& userValues, int numValues) {

  int tmp = 0;

  vector<int> newVec;

 

  for(int i = 0; i < numValues; i++) {

     cin >> tmp;

     newVec.push_back(tmp);

     

  }

 

  return newVec;

}

void OutputIntsLessThanOrEqualToThreshold(vector<int> userValues, int upperThreshold) {

  for (int i = 0; i < userValues.size(); ++i) {

     if(userValues.at(i) < upperThreshold) {

          cout << userValues.at(i) << " ";

     }

  }

 

  cout << endl;

}

int main() {

  vector<int> userValues;

  int upperThreshold;

  int numValues;

 

  cin >> numValues;

  userValues = GetUserValues(userValues, numValues);

  cin >> upperThreshold;

  OutputIntsLessThanOrEqualToThreshold(userValues, upperThreshold);

  return 0;

}

Explanation:

Perhaps their is a better way to code this, but I couldn't figure out what to do with the pointer in the first function.

In this lab you are asked to declare two variables of type integer: userNum and x. The user should input should be stored using scanf statements. Then you are asked to divide the value for userNum by x three times(three different operations). Each time you do the division, assign the value to userNum overwriting the previous value and print it out using a print statement. Do this three times. In this case there is only one new line print statement at the end.
#include
int main(void) {
int x;
int userNum;
scanf("%d %d" , &userNum, &x);
userNum = (double)userNum / x;
printf("%d " , userNum);
userNum = (double)userNum / x;
printf("%d " , userNum);
userNum = (double)userNum / (double)x;
printf("%lf\n" , (double)userNum);
return 0;
}
my input is 100 2
my output is 50 25 12.000
8 months ago

Answers

Answer:

See Explanation

Explanation:

Your program is correct and it follows the correct sequence; however, the reason you keep getting integer result is because the question requires that you declare both variables as integer.

The only modification required in your program is to change change #include to #include <stdio.h> for the program to be free of error.

Brian needs to assign a macro to a button on the ribbon. Where should he go to achieve this goal?
Record Macro dialog box
Macros dialog box
Insert tab, Insert Macro icon
Customize the Ribbon area of the Word Options dialog box

Answers

Answer: A. Record Macro dialog box.

Explanation:

Answer: a

Explanation:

Which tasks can Kim complete using the Customize Ribbon dialog box? Check all that apply.

Rename existing ribbon tabs.
Rearrange ribbon commands.
Add a new main tab to the ribbon.
Add commands to existing groups.
Create new PowerPoint commands.
Add a new contextual tab to the ribbon.

Answers

Answer:

Its A, B, C, and F

Explanation:

On edg

Rename existing ribbon tabs, Rearrange ribbon commands, Add commands to existing groups and Add a new contextual tab to the ribbon.

What is PowerPoint presentation?

A PowerPoint presentation is a type of visual aid that creates a slideshow of information that can be presented to an audience using Microsoft PowerPoint software.

It is typically made up of a series of slides that include text, images, charts, graphs, and other multimedia elements to convey information to the audience.

Kim can complete the following tasks by using the Customize Ribbon dialog box:

Existing ribbon tabs can be renamed.Rearrange the commands on the ribbon.To existing groups, add commands.To the ribbon, add a new contextual tab.

Thus, Kim cannot use the Customize Ribbon dialog box to add new PowerPoint commands or a new main tab to the ribbon.

For more details regarding presentation ,visit:

https://brainly.com/question/14498361

#SPJ7

What is a backdoor?
A. A different sign-in page to log into a computer
B. An unrecognized entry into a computer or system
C. A fake version of software to access a computer system
D. An administrative login feature of computer software

Answers

B. Generally backdoors are logins/access to something without permission and without admins knowing.

easy points
Cats or dogs? :D

Answers

Cats are better than dogs

RAM
Clear sel
19. Which computer memory is used for storing programs and data
currently being processed by the CPU?
Mass memory
RAM
O Neo-volatile memory

Answers

Answer:

The answer to this question is given below in the explanation section

Explanation:

The correct answer is RAM.

RAM is used for storing programs and data currently being processed by the CPU.  So, the data in the RAM, can be easily accessible and processed by the CPU more fastly.

While Mass memory and neo volatile memory is not correct options. because these types of memory can stores a large amount of data but CPU fetch data from these memories into RAM. and, RAM can only be used by the CPU when performing operations.

After modifying a numbered list in her presentation, Su notices the numbers and the text are too close to each other. She knows she can solve this issue by using the hanging indent marker. Unfortunately, the ruler is not visible in her PowerPoint workspace.

Which tab and command group should she use to access the ruler? (View, Show or Insert, Add-ins or Home, Paragraph)
After selecting the numbered list, in which direction should she drag the hanging indent marker to increase the space between the numbers and the text? (upward or downward or to the left or to the right)

Answers

Answer:

1. View, show

2. to the right

Explanation:

On edg

Answer:

1) View, Show

2) to the right

Explanation:

Please help I upped the points and please don't answer if you don't have the answer..

3. Describe two of your long-term financial goals, and explain why these goals are important to you. List three steps that might help you accomplish this goal. (4-6 sentences. 2.0 points)

4. Describe and example of common financial resource, and example, and a debt. These can be examples from your own life or from other people you know or can imagine. (3-6 sentences. 3.0 points)

Answers

Answer:

3. Paying for my daughter to attend college and building a life outside of struggle. These goals must be accomplished by me finishing school, going onto college and maybe even starting my own business. I must set an appropriate example for my daughter to learn from someone who she believes in. Starting a family business to pass down to generations will be an excellent way to start financially planning now ahead of time.

4. Living in a family of mines, common financial resource is either government assisted or public security.An expense that I cannot escape now is the caring for of my daughter which will vary as she get older. Lastly a debt would be the over spending of credit cards with no money to pay it back as the interest rates climb.

Explanation:

Finally, Lee wants to modify the table he linked to his presentation. How should he begin?

Highlight the table.
Click the table once.
Double-click the table.
Launch the Excel application.

Answers

Answer:

C. double-clike the table

Explanation:

Edg

Answer:

c

Explanation:

Write both an iterative and recursive solution for the factorial
problem.

Answers

Answer:

Explanation:

Recursive:

C++ program to find factorial of given number  

#include <iostream>  

using namespace std;  

unsigned int factorial(unsigned int n)  

{  

   if (n == 0)  

       return 1;  

   return n * factorial(n - 1);  

}  

 

// Driver code  

int main()  

{  

   int num = 5;  

   cout << "Factorial of "

        << num << " is " << factorial(num) << endl;  

   return 0;

Iterative:

// C++ program for factorial of a number  

#include <iostream>  

using namespace std;  

 

unsigned int factorial(unsigned int n)  

{  

   int res = 1, i;  

   for (i = 2; i <= n; i++)  

       res *= i;  

   return res;  

}  

 

// Driver code  

int main()  

{  

   int num = 5;  

   cout << "Factorial of "

        << num << " is "

        << factorial(num) << endl;  

   return 0;  

}

Other Questions
Assume the two lines AB and XY intersect as in the diagram below. Which of the following statements are true?Check all that apply. What is the product?254X 47O 11,618O 11,818O 11,838O 11,938 HELPPPP PLEASE I ONLY HAVE 6 MINUTES LEFT HELP ME Read this short passage and answer the question below:Excerpt from The Little MermaidBy Hans Christian Andersen"Come, little sister," said the other princesses; then they entwined their arms and rose up in a long row to the surface of the water, close by the spot where they knew the prince's palace stood. It was built of bright yellow shining stone, with long flights of marble steps, one of which reached quite down to the sea. Splendid gilded cupolas rose over the roof, and between the pillars that surrounded the whole building stood life-like statues of marble. Through the clear crystal of the lofty windows could be seennoble rooms, with costly silk curtains and hangings of tapestry; while the walls were covered with beautiful paintings which were a pleasure to look at. In the center of the largest saloon a fountain threw its sparkling jets high up into the glass cupola of the ceiling, through which the sun shone down upon the water and upon the beautiful plants growing round the basin of the fountain. Now that she knew where he lived, she spent many an evening and many a night on the water near the palace. She would swim much nearer the shore than any of the others ventured to do; indeed once she went quite up the narrow channel under the marble balcony, which threw a broad shadow on the water. Here she would sit and watch the young prince, who thought himself quite alone in the bright moonlight. She saw him many times of an evening sailing in a pleasant boat, with music playing and flags waving. She peeped out from among the green rushes, and if the wind caught her long silvery-white veil, those who saw it believed it to be a swan, spreading out its wings.Based on details in the story, the reader can conclude that the little mermaid A) cares more about humans than her sisters do B) loves the beauty of the princes palace more than her home C) is unhappy with her life below the sea D) is too shy to try and talk to the prince plzz help Carefully read the passage from the Quran here. In a well-structured paragraph, write a summary that describes three main ideas in the passage. The delegates at the Constitutional Convention agreed to..? Qu consecuencias trajo la reduccin o eliminacin de impuestos y cargas tributarias para el gobierno de Iturbide? Which equation can be used to find the unknown length, a, in this triangle? You can answer all if you would like but only a few would be fine as well A given volume of gas at a temperature of 100 K has apressure of 225 kPa. At a higher temperature, the samevolume of gas has a pressure of 450 kPa. At whattemperature does the gas have this higher pressure? Multiple choice English! 7x = -84Solve the equation In addition to hot surface temperatures, which characteristic makes mercy different from earth 4X + 2( X+ 7) = 5(X-3) * Three times a number decreased by 5 equals 10. Write the equation and find the number. Which of the following is a cell? a. Antibody c. VirusE. coli bacterium d. ribosome 3. Which of the following is NOT a cell?a. Yeast c. parameciumb.Sperm d. DNA/chromosomePLEASE HELP how big was india before pakistan and bangladesh were separated from it 100 POINTS HELP!!!!!!!!!!!!! A recipe uses 834 cups of milk for every 312 cups of oatmeal.How many cups of milk are used for each cup of oatmeal Plymouth Colony was originally founded by a group of people called Pilgrims. Since Plymouth did not have an official charter from England, its government was based on which document? True or False:Evolution acts on life and leads to adaptations in species.