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]
3 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]3 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
How to determine the critical crack size for a<br> plate
Blababa [14]
Wait what? is that really a question orr
7 0
3 years ago
SQL statement to verify the updated name field for the publisher with ID 5 SELECT * FROM Publisher WHERE PubID=5;
hichkok12 [17]

Answer:

Option(a) i.e "true" is the correct answer for the given question.

Explanation:

The select statement is used for fetching the record in the database. Select is the Data manipulation command. The given query gives  all the records where id=5 from the table publisher in the table format.After executing of query the user can verify that the field is updated or not in the table.

So the given statement is "true".

7 0
3 years ago
Which type of password would be considered secure
max2010maxim [7]
Try using at least one capital letter and multiple number and symbols
Example: [email protected]#3
5 0
3 years ago
Read 2 more answers
What are specific and relevant terms that will help you locate information using an internet search engine?
Liono4ka [1.6K]
I would say A:keywords

Hope this helps

I’m sorry if this is wrong

Have a great day/night
3 0
3 years ago
In Windows Vista, which location contains the Printer link?
ipn [44]
I believe it's B.) Printer and Faxes.
3 0
3 years ago
Read 2 more answers
Other questions:
  • The file extensions .webm, .m4v, and .ogv are used for:
    15·1 answer
  • Approximately what percent of desktop PCs are used for work-related purposes?
    12·1 answer
  • Which of these engine components forms a tight seal between the piston and the cylinder and is necessary for proper engine opera
    13·2 answers
  • What is the output of 1101 x 10 == 11000 + 10?
    12·1 answer
  • When including multiple images in a report, it may help to create a _____ on each image so you can cross reference them througho
    11·1 answer
  • Identify the terms associated with the given statements below;
    6·1 answer
  • In a Java Script language. create a two-dimension array consisting of numbers representing costs. After creating the array, prin
    11·1 answer
  • Who has gotten a random file link from someone? What file does it contain?
    8·2 answers
  • What is a mod in programming?<br><br> Give more Java questions
    12·1 answer
  • If anyone knows how to code on python:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!