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
Naddik [55]
2 years ago
12

Write a function to reverse a given string. The parameter to the function is a string. Function should store the reverse of the

given string in the same string array that was passed as parameter. Note you cannot use any other array or string. You are allowed to use a temporary character variable. Define the header of the function properly. The calling function (in main()) expects the argument to the reverse function will contain the reverse of the string after the reverse function is executed.
Computers and Technology
1 answer:
babymother [125]2 years ago
6 0

Answer:

Following are the program to this question:

#include <iostream> //defining header file

using namespace std;

void reverse (string a) //defining method reverse  

{

for (int i=a.length()-1; i>=0; i--)  //defining loop that reverse string value  

 {

     cout << a[i];  //print reverse value

 }

}

int main() //defining main method                                                                                          

{

string name; // defining string variable

cout << "Enter any value: "; //print message

getline(cin, name); //input value by using getline method

reverse(name); //calling reverse method

return 0;

}

Output:

Enter any value: ABCD

DCBA

Explanation:

In the above program code, a reverse method is declared, that accepts a string variable "a" in its arguments, inside the method a for loop is declared, that uses an integer variable "i", in which it counts string value length by using length method and reverse string value, and prints its value.

  • In the main method, a string variable "name" is declared, which uses the getline method.
  • This method is the inbuilt method, which is used to input value from the user, and in this, we pass the input value in the reverse method and call it.  
You might be interested in
Press the _______ key to move to the next cell in a row.
slamgirl [31]

Tab is the answer! And it says i need 20 chacters to explain so im writing random stuffff



4 0
3 years ago
Generally speaking, the _______ the risk, the _______ the potential return or loss
givi [52]
<span>The correct answer is higher for both blank spaces.

We all know the famous saying: "No risk, no reward". What is true is the higher your risk you also have a higher degree of reaping a higher rewards. But the opposite is also true, the more you risk the more you stand to lose. In stockbroker business this is best exemplified, as you can se brokers trying to predict the stock market in order to make greater profits. Gambling is also the good example of this. </span>
6 0
2 years ago
Read 2 more answers
Question #6
Vitek1552 [10]

Answer:

ValueError

Explanation:

Required

Determine the error the program returned

The above will return a ValueError error and the reason is as follows.

The first line of the program initializes variable as 'live'.

The next line tries to convert answer to integer and this is where it returns the error'.

On the second line, variable amount expects that the answer variable to contain number e.g. '567' but because it doesn't contain a complete number (i.e. unexpected values), the program returns a ValueError.

7 0
2 years ago
Read 2 more answers
In minecraft Education Edition what is the crafting recipe for Balloons and Glow sticks?
schepotkina [342]

Answer

sorry I only know how to make balloons :(

Explanation:

For the balloons the recipe that one is:

- you will need 6 latex

To make latex you will need two different elements one is 5 Carbon and the other one is 8 Hydrogen ( don't use crafting table to do it use the compound creator)

-Dye ( whatever color you want)

-Helium

-lead

Instructions

on the crafting table the latex will go on the sides (3 on the left and 3 on the right). The dye goes on top, the Helium in the middle and the lead at the bottom and there you go a balloon

8 0
3 years ago
Read 2 more answers
Formatting changes only the appearance of data ___it does not affect the data itself.
Vladimir [108]

Answer:

The answer to this question is "true".

Explanation:

In this question, the answer is true because The use of formatting provides changes in the data presentation, not in the data. It is also known as layout.

The layout or formatting is important for two reasons that can be given as:  

1) It makes your data like a formatted data.

2) It helps to make your data more readable.

8 0
3 years ago
Other questions:
  • Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of
    14·1 answer
  • What is something you can do to stay connected to the relationships in your life while we spend this time at home?
    13·1 answer
  • One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input
    12·2 answers
  • To display data in a certain manner, like alphabetical order, is called
    5·2 answers
  • Do u have to divide or multiply this problem 5300 yd = mi
    9·1 answer
  • How do you remove management from your chrome book [administrator]
    12·1 answer
  • The lower band and upper band of integer data type​
    6·1 answer
  • 2. The<br>is the main and usually largest data storage hardware device in a computer​
    9·1 answer
  • How do you convert an algorithm to make it possible for a computer to read
    6·1 answer
  • Need help ASAP.<br> I am so lost.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!