Write a program that takes a string as input

Assignment Help C/C++ Programming
Reference no: EM13493255

c++ program
Reverse
Write a program that takes a string as input (from the user) and then reverses the contents of the string. Your program should work by using two pointers. The "head" pointer should be set to the address of the first character in the string, and the "tail" pointer should be set to the address of the last character in the string (i.e. the character before the terminating null). The program should swap the characters referenced by these pointers, increment "head" to point to the next character, decrement "tail" to point to the second to last character, and so on, until all characters have been swapped and the entire string reversed.
Hint: Use the length of the string to calculate the address of the last character in the string. Loop until head >= tail. You may have to convert your string variable to an array of char- acters.
Filename: reverse.cpp

Reference no: EM13493255

Questions Cloud

Focusing on the goals of private businesses : Focusing on the goals of private businesses, and the goals of lawmakers for economic progress and economic security, select one example private-sector industry, describe the general business goals by using information on the web sites of one o..
Determine the spheres volume charge density : A nonconducting solid sphere of radius 11.2 cm has a uniform volume charge density. What is the sphere's volume charge density
The construct lifestyle in market segmentation : European Journal of Marketing, 36 (1/2), pp. 51-85. Assess the thesis of the authors in regards to the construct ‘lifestyle'. Examine the other innovations that are presented in the article.
What is the radius of the cylinder : An object is located on the inner side of a spinning cylinder with an angular velocity of 20rad/s. what is the radius of the cylinder
Write a program that takes a string as input : Write a program that takes a string as input (from the user) and then reverses the contents of the string. Your program should work by using two pointers.
Explain how would the retention time of a solute in gas : How would the retention time of a solute in gas chromatography change if the flow rate of the carrier gas is slowed down?
How you would take advantage of this opportunity : Suppose you observe that a three-year, default-free security with an annual coupon rate of 10% and a face value of $1000 has a price today of $1183.50. Is there an arbitrage opportunity? If so,show specifically how you would take advantage of this op..
Produce a diagram of a proposed network : Produce a diagram of a proposed network
Create a chart of t-accounts : Analysts predicted earnings per share (EPS) for your company to be $0.12 at the close of 2011.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Ansi-c program complete assignment as per written in the

complete assignment as per written in the attached

  Const int num_years

How do you get this program to get both player input and then display results(As described on bottom) #include  const int NUM_YEARS=15;//The number of years const int NAME_SIZE=32;//The max size of the player name string

  Randominrange() function that accepts two integer

Write a randomInRange() function that accepts two integer parameters. The parameters will represent the low number and the high number (both inclusive) in the random range. For example, when the function receives 3 and 8.

  Design is known, what advantages does keeping

Given that the design is known, what advantages does keeping the source code unavailable give the company and those who purchase the software? What disadvantages does it cause?

  Displays columns titled "name", "quantity", "price", value

Write a program that displays columns titled "Name", "Quantity", "Price", and "Value". The fourth column contains the result of multiplying each item's quantity by its price. In addition, the program should calculate and display the total value of th..

  8-bit or 16-bit mode, and the prescaling ratio

8-bit or 16-bit mode, and the prescaling ratio. You can assume XTAL = 10M Hz or at the frequency you specify.

  Performs a binary search instead of a linear search.

Modify the following program so it performs a binary search instead of a linear search. Use the selection sort algorithm to sort the array before the binary search is performed.

  Determine the position in the x-y plane

Every circle has a center and a radius. Given the radius, we can determine the circle's area and circumference. Given the center, we can determine the position in the x-y plane.

  Write a function named largest which will receive the array

Write a function named largest which will receive the array as input and return the variable LargestNumber.

  Find the amount in the savings act each month

Suppose you start with $1000 and each month you contribute $100. suppose that the interest rate is 6%per year compounding monthy,which is equal to 0.5% each month.

  It should be clear, based on your comments

Add comments to the code. It should be clear, based on your comments, what each line (or set of lines) does in the program.

  Create a program, using at least one for loop

Create a program, using at least one For loop, that displays the Sales Amounts made in each of 4 regions (North, South, East, and West) during a three month period.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd