In: Computer Science
You have been asked to write program that allows the user to input a first name, middle initial (without the period), and last name of a user and then display that person’s name with the first, middle initial followed by a period, and last name last.
BEFORE creating the program, use structured programming principles to document how you are going to develop the program. Use Microsoft Word to complete this part of the assessment. Answer each of the following areas:
Solve a problem by following the steps of the program development cycle.
Design the program in a modular fashion.
Design each module as a series of sequence control structures.
Use Microsoft Word to answer
/* It is a fairly simple program.Steps are as follows:
1.Input module - This is responsible for obtaining the
input in
the required way.
The input is taken in a single line with
entries separted by spaces:
first name middle initial last name.
The inputs stored in string data types.
2.Output module - This displays the output as
expected.
*/
code in C++:
#include
#include
using namespace std;
int main(){
string first, middle, last; // variable declaration
cout << "Enter first name , middle initial and last name:
"; // Input the name
cin >> first >> middle >> last;
cout << first << " " << middle[0] << "."
<< last << "\n";//Display the name
return 0;
}
Output: