Question details

Write a C++ Program
$ 8.00

Sunday Deadline

Core Learning Outcomes addressed in this assignment:

  • Demonstrate creativity and problem-solving skills. (9)
  • Write C++ programs that use proper style and documentation. (10)

Grading Information: This Lab Homework is worth 76 points and due by Sunday of week 1 at midnight CST.

The purpose of this assignment is to assess if you can create a program that uses strings.

Directions Points The file must be called stringProg.cpp 6 Main Method

1. Declare a string called myString.
2. Use Call-by-reference pass your string to a method called inputData(); (Hint:uses the &)
3. Use Call-by-value and pass your string to a method called outputData(); (Hint:does not use the &)

20 inputData Method (Receives string)

  1. Get input using cin >> into the string variable you received into this method. (I will be entering my full name in the format of: Last, First Middle.
  2. Using the string methods mentioned in this weeks lecture, have your program change the string to: First Middle Initial Last.
  3. I would like you to break the string you received apart into 3 separate variables: firstlastmiddle. (Hint: use find() to find the "," and spaces and use substr() to extract the pieces)
  4. Use string concatenation to reassemble the string and overwrite the string you received with the new value.
  5. You must use each of the following string methods (at least once): substr(),length()find()insert()erase().
  6. Notice the "," is missing out of the name.

30 outputData Method (Receives string)

  1. Output the new string to the screen using cout <<.
  2. Comments are required, but pseudocode or flowchart are not.
  3. All Input/Output should be done using the standard C++ library string class.
  4. Include: system("PAUSE"); after your output to pause the screen.

10 Ensure you include ALL .cpp file(s) and any associated, student-defined .h (header) files required to make your program compile and run. The only files in the dropbox should be .cpp and .h files.  Do not turn in .zip, .exe, .rar, etc files. 5 Upload your page to the Dropbox.

a

 

From Computer Science, General Computer Science Due on: 17 Jan, 2016 04:53:00 Asked on: 15 Jan, 2016 07:54:49
Due Date has already passed, but you can still Post Solutions.
Available solutions
    No solution has been posted yet.Be first to post the solution!