3. At a gift shop, customers can choose to print their names on a small keyring. The maximum number of letters that can

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

3. At a gift shop, customers can choose to print their names on a small keyring. The maximum number of letters that can

Post by answerhappygod »

3 At A Gift Shop Customers Can Choose To Print Their Names On A Small Keyring The Maximum Number Of Letters That Can 1
3 At A Gift Shop Customers Can Choose To Print Their Names On A Small Keyring The Maximum Number Of Letters That Can 1 (98.15 KiB) Viewed 32 times
3. At a gift shop, customers can choose to print their names on a small keyring. The maximum number of letters that can fit on the keyring is 12, including the space between the first and last name. The store assumes the maximum length of both first name and last name is 10 letters each. Write a C++ program that 1. Asks the customer to input their first and last names 2. Checks if the full name (including a space in the middle) can fit on the keyring a. If it doesn't fit tell the user it's too long then ask for the name again b. If it fits, concatenate the two names into one c-string to be printed, then confirm the name to the user Hints: use strlen (c) to find the length of a string use sirsky (a, b) to copy string b to string a use strcat (a, b) to concatenate strings a and b and store the result in string a . . . Sample Output Enter your first name > Monsieur Enter your last name > Potatoes Sorry, that name is too long. Perhaps you can enter your initials? Enter your first name > Mister Enter your last name > Potatoes Sorry, that name is too long. Perhaps you can enter your initials? Enter your first name > M. Enter your last name Potatoes Your keyring will have the name "M. Potatoes" printed on it
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply