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
Oliva was a sophomore thriving in college when her father was laid off from his job. Even with financial aid, the family could n
Zielflug [23.3K]

Answer:

Linked Lives

Explanation:

Linked-lives is a popular preposition, the idea is that people who are related to each like father-child or mother-child relationship have similar influencing trajetories of development that cuts across their lives.

6 0
4 years ago
What does gps stand for ?
frutty [35]
GPS stands for Global Positioning System
3 0
4 years ago
Read 2 more answers
Q-3 A technician is setting up a computer lab. Computers on the same subnet need to communicate with each
Tasya [4]

Answer:

the answer would be B proxy server

4 0
4 years ago
I. A teacher can prepare a slide and demonstrate it in the class with the help
marin [14]

Answer:

ay di ko alam yan hahahaha

3 0
3 years ago
Can anyone do this flowchart chart for me could send it to my insta - chelsea.ejb
arlik [135]

Answer:

see attached picture

Explanation:

An algorithm would be:

if hours < 10 then bonus = 0

else if hours <= 15 then bonus = 1000

else if hours <= 20 then bonus = 1500

else if hours <= 25 then bonus = 2000

else if hours <= 30 then bonus = 3000

else bonus = 5000

6 0
3 years ago
Other questions:
  • Fill in the blank - A generation of social-oriented, physical games such as the _______ Wii console, emerged in the late 2000s,
    15·1 answer
  • Please help. 15 points!!!!
    8·2 answers
  • What kind of negative social impact has wireless communications had on today's society?
    6·2 answers
  • Select the education and qualifications that are most helpful for business analysis careers. Check all that apply
    11·2 answers
  • Which of these statements regarding​ time-cost tradeoffs in CPM networks is​ true?
    6·1 answer
  • Cash cows are always in
    7·1 answer
  • How to do GCD on small basic?​
    7·1 answer
  • A slide titled Alexander Graham Bell. There are 6 bulleted entries on the slide, and there is a lot of text on the slide. There
    11·2 answers
  • The BCD number for decimal 473 is( ). a) 111011010; b) 010011110011; c) 010001110011; d)0010110110​
    15·1 answer
  • CALLING ALL COMPUTER SCIENCE LOVERS!!!!!!!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!