
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
![Write a complete C++ program that prompts the user to enter a
string, and prints out a message based on its length, according
to the following four conditions:
1. "Zero to Three" if the length is in [0, 3]
2. "Four to Seven" if the length is in [4, 7]
3. "Eight to Ten" if the length is in [8, 10]
4. "More than Ten" otherwise
Note: The string may contain whitespace
• For example: if the user enters the following string:
University of Regina, your program should print out: More
than Ten
Hint: use nested if-else statement
Fir](https://content.bartleby.com/qna-images/question/6ce7a571-e219-412d-8e50-69066a5a3932/31a9b44f-cb91-42f2-924a-fa0c59ba4ecd/dgeykam_thumbnail.jpeg)
Transcribed Image Text:Write a complete C++ program that prompts the user to enter a
string, and prints out a message based on its length, according
to the following four conditions:
1. "Zero to Three" if the length is in [0, 3]
2. "Four to Seven" if the length is in [4, 7]
3. "Eight to Ten" if the length is in [8, 10]
4. "More than Ten" otherwise
Note: The string may contain whitespace
• For example: if the user enters the following string:
University of Regina, your program should print out: More
than Ten
Hint: use nested if-else statement
Fir
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Using C language, write code that solves the following problem. Have the user enter a string that is at most 100 characters long. Count how many space characters ' ' are within the string.arrow_forwardWrite this program using the for loop in C#arrow_forwardWrite a function that finds the number of occurrences of a specified character in the string using the following header: int count(const string& s, char a) For example, count("Welcome", 'e') returns 2. Write a test program that reads a string and a character and displays the number of occurrences of the char- acter in the string.arrow_forward
- language is c++arrow_forwardWrite a C++ program that asks a user to enter an integer between 0 and 1000 and adds all the digits in the integer. For example, if a user enter 932, then the program should display 14.arrow_forwardThe expressions string[0] and string[:1] are the same. Select one: True Falsearrow_forward
- c code dfdfvdsvadsvarrow_forwardWhen allocating the size of a C-style string, assume you want to store the string, "Hello, World!". What is the minimum size of the string you would need to allocate. Show how you would declare the stringarrow_forwardDevelop a program that allows the user to enter a string. The program must count and display the number of characters in the string. Run the program with the following string values: “I love python” “Programming is fun” program must include a processing loop that allows multiple sets of data to be processed and the program should be terminated when there is no more data to processarrow_forward
- USing basic C++ code pls!!!arrow_forwardc code needs to ask user for a number sfasddasfasarrow_forwardWrite a FUNCTION that asks the user to input a string. Unless the user inputs "END" or "end", a loop will execute wherein the user is asked to input a string. Each time the loop runs and the user input a string, the function does the following: +Print the number of letters in the string that the user inputs; +Print the number of digits in the string that the user inputs. When the user enters "END" or "end" the loop stops and the function prints the aggregate numbers of letters and digits that the user has entered from the beginning. Example: 1st loop: a8K6H => 3 letters and 2 numbers 2nd loop: THGF*T425 => 5 letters and 3 numbers Aggragates: 8 letters and 5 numbersarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education