Question

Write a C++ program that produces the following output: /* OUTPUT Enter your age: 21 Enter...

Write a C++ program that produces the following output:

/* OUTPUT

Enter your age: 21

Enter the last name: Lee

Hello Tom Lee. You are 21 years old.

Press any key */

  1.   Declare an array named: firstName
  • The array is a c_string, i.e., it is a null-terminated character array.
  • The size of the array is 10.
  • Assign a first name to it when it is declared.
  1.   Declare an array named: lastName
  • The array is a c_string,
  • The size of the array is 10.
  • Don’t assign a name to it.
  1.   Declare an array named: fullName
  • The array is a c_string,
  • The size of the array is 20.
  • Don’t assign a name to it.
  1.   In main():
  • First ask the user for the age.
    • Read the age and assign it to a variable.
  • Then ask the user for the last name.
    • Read the last name and assign it to lastName.
  • Assign the first and last names to fullName.
    • Make sure to include a space between the names.
  1. Call a function named: displayInfo().
  • The function should output the full name and age. (see output)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have Use online gdb compiler for C++ Site Link :-  www.onlinegdb.com/online_c++_compiler Shown Below Image

Add a comment
Know the answer?
Add Answer to:
Write a C++ program that produces the following output: /* OUTPUT Enter your age: 21 Enter...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In JAVA #3 Write a program named nameChanger.java. This program will only have a driver class...

    In JAVA #3 Write a program named nameChanger.java. This program will only have a driver class with a main. This program will have the user enter a series of names(first and last), which will then be stored in a String array. You will then change the values of each of the names in the array, so that they are stored lastname, firstname, and then output the revised array. Sample: Enter a name (first and last): Tonya Pierce Enter a name...

  • Please create a program answering the following question in C PROGRAMMING. CorrectFormation Create a program and...

    Please create a program answering the following question in C PROGRAMMING. CorrectFormation Create a program and locally declare in main fname and Iname and completeName. Ask the user for their first and last name. Put the values into fname and Iname. You will create a function that is called as followed oinNames( fname, Iname, completeName ); You will pass the first name array, the last name array, and the array that will contain the complete name. The function named joinNames...

  • read the code and comments, and fix the program by INSERTING the missing code in Java...

    read the code and comments, and fix the program by INSERTING the missing code in Java THank you please import java.util.Scanner; public class ExtractNames { // Extract (and print to standard output) the first and last names in "Last, First" (read from standard input). public static void main(String[] args) { // Set up a Scanner object for reading input from the user (keyboard). Scanner scan = new Scanner (System.in); // Read a full name from the user as "Last, First"....

  • a) In Atom, create a new program file named greetByfullName.jsin your pl folder. b) Write a...

    a) In Atom, create a new program file named greetByfullName.jsin your pl folder. b) Write a function named greetByfullName that accepts two strings (firstName and lastName), and returns a cheery greeting. c) Test the function by prompting the user to enter their first name, and storing the name in a variable, and then prompting the user for their last name, and storing it in a second variable. This page says Enter your first name Susan Cancel OK This page says...

  • has to be done in c programming not c++ 5:28 . O Done Lab_Seven Lun, wuUULIVIL...

    has to be done in c programming not c++ 5:28 . O Done Lab_Seven Lun, wuUULIVIL - - - - - - - - Write a program that prompts the user to input their first name, from the keyboard and stores them in the variable "firstName". It does the same for last name and stores it in the variable "lastName". It then uses strcat to merge the two names, separates them by a space and stores the full name into...

  • //Done in C please! //Any help appreciated! Write two programs to write and read from file...

    //Done in C please! //Any help appreciated! Write two programs to write and read from file the age and first and last names of people. The programs should work as follows: 1. The first program reads strings containing first and last names and saves them in a text file (this should be done with the fprintf function). The program should take the name of the file as a command line argument. The loop ends when the user enters 0, the...

  • Java Homework Problems: 4. • Examine AddImport.java. – Perform the following: – Replace the fully qualified...

    Java Homework Problems: 4. • Examine AddImport.java. – Perform the following: – Replace the fully qualified name to access the Jlabel component with an import statement. – To import classes from the util package, replace multiple import statements with a single import statement. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Calendar; import java.util.Date; public...

  • C++ Program 1 – Write a program that determines if a person is an adult. Declare...

    C++ Program 1 – Write a program that determines if a person is an adult. Declare a string variable, firstName. Declare an integer variable, age. Asks the user to enter their first name, and store it in the firstName variable. Asks the user to enter their age in years, and store it in the age variable. If the age is greater or equal to 18, the print out their name and “you are an adult” Else print out their name...

  • 2- Write a program that has a Person class, a Student class, that is derived from...

    2- Write a program that has a Person class, a Student class, that is derived from Person, and a Faculty class, derived from Person as well, with the following specifications: The Person class has the following members: a. An integer private member variable named SSN. b. Two string protected member variables named firstName and lastName. C. An integer protected member variable named age. d. A constructor that takes SSN, first name, last name, and age as parameters. e. A constructor...

  • I need help with this program using c++ language! CS 317 Program Assignment Name Arrange You...

    I need help with this program using c++ language! CS 317 Program Assignment Name Arrange You are to write a program that will read in each person’s name and print out the results. The list has been collected form different places and the names are not in some standard format. A person’s last name may appear last or it may appear first. A label has been associated with each name to identify where the last name appears. Either “surname” or...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT