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

  Problem 1greatest common divisor write code for a recursive

problem 1greatest common divisor write code for a recursive implementation of euclids algorithm for searching the

  A constructor and a destructor

A constructor and a destructor, Insert a new element chosen by the user at the correct place in the list

  Write a program that allows users to enter a dollar amount

Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month. Then ask the user to enter a dollar amount for any number of checks written in a month, up to 50. Include an approriate sentinel ..

  Implement recursive algorithms using a stack

Show the difficulties of the added complexity and which of the two sorts is easier to implement nonrecursively? Why?

  Write a c program that asks for and reads in two integers

Write a C program that asks for and reads in two integers and then reports if one is a multiple of the other.

  Prompt the user for 3 sentences of text

Prompt the user for 3 sentences of text. Pass these pieces of text into a function connect() which will connect all three sentences into one long sentence. Pass the combination sentence back to the main program, where it is printed.

  Design a cruiseship class that is derived from ship class

SEN 970 Object-Oriented Programming in Objective-C. Demonstrate the classes in a program that has an array of ship pointers. The array elements should be initialized with the addresses of dynamically allocated Ship, CruiseShip and CargoShip objects..

  You should use pure recursive calls

You should use pure recursive calls completely and count the number of calls the program makes. You should count how many times recursive calls were made.

  Represent an instruction supported by simpletron

Implementation contains a Simpletron class and several supporting Instruction classes

  You are required to prepare a program for assessment system

you are required to prepare a program for assessment system of a university. the main idea is to evaluate the gpa

  Write program to perform add-drop-list and update functions

Write C++ program to do add, drop, list (in last name / first name sorted order or id) and update functions. separate UI from data processing use object programming method multiple files

  Using an abstract class with only pure virtual functions

Using an abstract class with only pure virtual functions, create three small classes unrelated by inheritance---clases Building, Car and Bicycle. Give each class some uique appropriate attributes and behaviors that it does not have in common with oth..

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