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
An ecommerce ____________ is the software that handles ecommerce transactions.​
Shkiper50 [21]
<span>An ecommerce application is the software that handles ecommerce transactions.​  It helps customers to find products, make a selection and submit payment.  A key component of an ecommerce application is an online shopping cart. </span>
7 0
2 years ago
Which of the following is the most appropriate wireless technology for real-time location of caregivers and mobile equipment in
Gekata [30.6K]
Wi-Fi is the anwser.Hope I helped.
7 0
2 years ago
What do you call when a hacker users multiple guest computers to crack a password?
azamat

Answer: Botnet

Explanation:

Botnet is the process when a hacker user uses multiple guest computer to crack a password. Basically, hackers use botnet for performing the distributed denial of services attack in the network.

It also steal the data and allowed attacker to approach its connection and access its device.

Botnet word is the combination of robot and network and botnet can be controlled by using the command and control software.

6 0
3 years ago
Brainly keeps deleting my questions and I don’t know why It says I violated the rules but I didn’t. pls help
labwork [276]

Well brainly could be deleting you question because of things like,

  • The question is for an exam
  • The question does not include proper question material
  • A singular swear word
  • Its not subject related to(math, science, history or etc).

<em>Hope this helps!</em>

3 0
2 years ago
The ____ package contains frequently used classes and is implicitly imported into java programs.
Snowcat [4.5K]

Java.lang is the answer you're looking for

8 0
3 years ago
Other questions:
  • C programming:
    10·1 answer
  • What is the theory of trouble shooting
    10·2 answers
  • Explain the need for data structures when developing software.
    12·1 answer
  • When a router forwards incoming packets closer to their destination hosts, this is called?
    9·1 answer
  • Which component of the windows desktop allows you to retrieve files that have recently been deleted?
    11·1 answer
  • Grace is performing a penetration test against a client's network and would like to use a tool to assist in automatically execut
    13·2 answers
  • 20 examples of input device?
    9·2 answers
  • For those that play pc games how do you go outside in The Sims 2?
    7·2 answers
  • A client is looking to maximize value from its Cloud investments by baselining, profiling, and prioritizing its human capital ne
    9·1 answer
  • What stipulates that the source code of any software published under its license must be freely available.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!