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
When giving a presentation it is better to ___________
Romashka-Z-Leto [24]
<span>C) Always better to give your information and end on time.</span>
6 0
3 years ago
Identify any eight new programming languages and classify them based on their functionality.
shepuryov [24]

Answer:

Some of the new programming languages are R, Python, Haskell, Swift, C++, Java, Javascript and PHP.

However, you should know that in general sense there are three types of programming languages.

R is a pure object-oriented programming language being used for scientific purposes, and now it is being used extensively for machine learning as well.

Python is also a pure object-oriented programming language, and it is being used for mainly machine learning. However, you need to keep in mind that it supports the functional programming paradigm as well.

Haskell is a functional programming language and is the best in the functional paradigm as well. You can compare it with LISP, FORTRAN and PASCAL or COBOL, and you will find that Haskell is the best.

Swift is a pure object-oriented programming language, And by pure it means it never cheats anybody like if it says a variable is an int, it will be an int and not like C# here a string data type can be an integer data type. And this is not the correct thing. However, if you study in deep, you will find it is a necessary evil.

C++ and Java are imperative programming languages.

The Javascript and PHP are the scripting languages that support the object-oriented programming concepts but not fully, and they too fall under the imperative programming language list.

Explanation:

The answer is self explanatory.

4 0
3 years ago
Read 2 more answers
Tom's Art Supplies used to sell art supplies through mail order catalogs, but the company's order takers often had difficulty de
olganol [36]
The answer is:bbbbbbbb
6 0
3 years ago
A review of the sales, costs, and profit projections for anew product to find out whether these factors satisfy the company'sobj
soldier1979 [14.2K]

Answer: Business analysis

Explanation:

Business analysis is the review of the sales, costs, and profit projections for a new product to find out whether these factors satisfy the company's objectives.

Based on the business analysis a company is able to set a marketing strategy for a better promotion of its products. So this step is particularly very important.

7 0
3 years ago
Tim has an old server computer that his company uses as a backup. One of the hard drives has gone bad and needs to be replaced.
algol [13]

Answer: SCSI hard drive.

Explanation:

SCSI means Small Computer System Interface.

It is a fast bus with the capacity to connect a number of devices to a computer system simultaneously, those devices includes printer, scanners, tape drives, hard drives, CD-ROM devices. SCSI helps to connect devices and transfer data in between computer and ancillary devices.

SCSI was invented by the American National Standard Institutes (ANSI)

Common Components of SCSI includes;

• Target.

• Expander.

• Service delivery.

• Initiator.

• Sub system.

3 0
3 years ago
Other questions:
  • Which statements describe the advantages of using XML?
    12·2 answers
  • What is the answer and why?
    12·1 answer
  • Identify the layout in which you will be able to view and edit the header and footer
    12·1 answer
  • Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the
    13·1 answer
  • Why is data processing done in computer
    10·1 answer
  • The stack pop operation
    10·1 answer
  • ____________ reference is used when you want to use the same calculation across multiple rows or columns.
    10·2 answers
  • ⚠VERY IMPORTANT MESSAGE⚠
    7·2 answers
  • A good machine should have the mechanical advantage of......?​
    7·1 answer
  • Which one do we use to send signals as IR light waves?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!