Question

Exercise #02 Create program that ask for the number of letter of your name Create an array of char type with the length of yo

This problem must be coded in C++ please !

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;
int main() {
   int n; // to input size
   cout<<"Enter number of letter in your name: "; // print msg
   cin >> n; // take input
   char name[n]; // create array
   cout<<"Enter name: "; // msg
   for(int i = 0 ; i < n; i++){
       cin >> name[i]; // take input in each element
   }
   cout<<"Your name is: "; // print name
   for(int i = 0 ; i < n; i++){
       cout<<name[i]; // print each character in array
   }
   return 0;
}

#include <iostream> using namespace std; int main() { int n; // to input size cout<<Enter number of letter in your name: ;

/* OUTPUT */

Enter number of letter in your name: 7 Enter name: Harvard Your name is: Harvard --------------------- ----- Process exited a

/* PLEASE UPVOTE */

Add a comment
Know the answer?
Add Answer to:
This problem must be coded in C++ please ! Exercise #02 Create program that ask for...
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
  • Create a C program to implement a grade book. Must follow these guidelines: 1. Use #define...

    Create a C program to implement a grade book. Must follow these guidelines: 1. Use #define to define MAX_SIZE1 as 20, and MAX_SIZE2 as 10 2. Use typedef to define the following struct type: struct { char name[MAX_SIZE1]; int scores[MAX_SIZE2]; } 3. The program accepts from the comand line an integer n (<= 30) as the number of students in the class. You may assume that the input will always be valid. 4. Dynamically allocate memory for an array of...

  • Create a program that counts how many times a number is included in an array. To...

    Create a program that counts how many times a number is included in an array. To create the array ask for 10 values (as integers) and then ask for the number that should be checked for. Then print the number of times the requested number appears in the array (see below). Please comment your code as you go along. Hint: You may need 2 for loops for this, one to create your array and one to check the values. Enter...

  • This is for C++ Write a program that reads in a sequence of characters entered by...

    This is for C++ Write a program that reads in a sequence of characters entered by the user and terminated by a period ('.'). Your program should allow the user to enter multiple lines of input by pressing the enter key at the end of each line. The program should print out a frequency table, sorted in decreasing order by number of occurences, listing each letter that ocurred along with the number of times it occured. All non-alphabetic characters must...

  • Create a program that takes in user input and stores the input into an array. Also...

    Create a program that takes in user input and stores the input into an array. Also within the program show how you can: show the elements in the array, remove an element from the array, add an element to the array. Do NOT ask the user how many elements they want to add, instead once they are done adding, they should hit ‘q’ and it should break out of the input. This is a c++ program. The input type shall...

  • 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...

  • In Language = C Concepts for this are (malloc/realloc, structs, and stdin/fgets/getc/scanf) Description Your program will...

    In Language = C Concepts for this are (malloc/realloc, structs, and stdin/fgets/getc/scanf) Description Your program will ask the user to type in the following information: First Name: Last Name: ID#: Email: The program will terminate when a single . is entered as a First Name. This information will be stored in the following structure type: struct student { int recordCount; char *firstName; char *lastName; char *id; char *email; } recordCount is a number assigned at the beginning of the program...

  • Write a Program in C language for: 1. Create a C program to read 7 integers...

    Write a Program in C language for: 1. Create a C program to read 7 integers and store them in an array. Next, the program is to check if the array is symmetric, that is if the first element is equal to the last one, the value of the second one is equal to the value of the last but one, and so on. Since the middle element is not compared with another element, this would not affect the symmetry...

  • (Java) HELP! Create a program that will ask the user to enter their first name and...

    (Java) HELP! Create a program that will ask the user to enter their first name and their favorite number. Ask the user if they would like the information repeated back to them. If they type "Y" display the answers back to them. If they type anything else, display the word "Goodbye". An example of what your output window should look like is below. The system-generated output is in red. The user-provided input is in green. (Your actual program will only...

  • Create the program in C++ please. The new operator as outlined in 10.9 . Create a...

    Create the program in C++ please. The new operator as outlined in 10.9 . Create a Test class that includes the following Data members • First Name, last name, test1, test2, test3 o Methods • Accessor methods for each of the data members' • Mutator methods for each of the data members . A Default Constructor . A constructor that will accept arguments for each of the 5 data members • A method that will calculate the average of the...

  • ASSIGNMENT: Create a program to do the following: BONUS: A bonus of 20 points if you create the p...

    ASSIGNMENT: Create a program to do the following: BONUS: A bonus of 20 points if you create the program in such a way that there is no limit on the number of names to be handled. 1) Read in names to sort until the user types the “enter” key as the first character of a “C-type” string (the maximum number of names is 20, there is not a maximum length to a name), using a two dimensional array of characters....

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