Database System Concepts
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
Bartleby Related Questions Icon
Related questions
Question
Please use c++ to write this code! Thank you very much
Transcribed Image Text:Write a program that generates a random
number between 1 and 50 and asks the user
to guess it. As a hint, it tells the user how
many divisors it has, (excluding 1 and the
number itself). Each time the user makes a
wrong guess, it displays "Wrong" and says if
the guess was too low or too high, until the
user gets it right, in which case it says
"Right" and says how many trials it took to
guess it. Then, the program asks the user if
he or she wants to continue. If the answer is
'y' or 'Y', it generates another number
between 1 and 50 and repeats the game. If
not, it prints the average of all trials with one
decimal place and ends.
Example:
I've picked a number between 1 and 50 that
has 0 divisor(s).
Guess the number: 23
Too low!
Guess the number: 37
Too low!
Guess the number: 43
expand button
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
This is a popular solution
bartleby
Trending nowThis is a popular solution!
bartleby
Step by stepSolved in 3 steps with 1 images
Knowledge Booster
Background pattern image
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
- C++ Programming I would like to make this code like the result(photo submitted). And please let me know how I can open it on notepad. ----------------------------------------------------------------- Code: #include<iostream>#include<fstream>using namespace std;int main();int taxi_num=5; int tx1_call=0,tx1_pass=0,tx2_call=0,tx2_pass=0, // Creating global variablestx3_call=0,tx3_pass=0,tx4_call=0,tx4_pass=0,tx5_call=0,tx5_pass=0; int total_passangers=0; // Total passanger count char NeedTaxi(){if(taxi_num<1) taxi_num=5;char ans; cout<<"\n\nDo you need Taxi (Y/N) : ";cin>>ans;if(ans!='Y' && ans!='N') {cout<<"\n\nError entry !\n\n"; main();}if(ans=='N') return ans;cout<<"Taxi #"<<taxi_num<<" will pick you up in a few minutes."; if(taxi_num==5) {tx5_call++; tx5_pass+=3;} // Add 3 passangers everytime taxi 5 calledif(taxi_num==4) {tx4_call++; tx4_pass+=5;} // Add 5 passangers everytime taxi 4 calledif(taxi_num==3) {tx3_call++;...arrow_forwardPlease us c++ to make the code thank you very much!arrow_forwardI need help making this program in C programming. Please look at the pictures provided at that helps. Thank You!arrow_forward
- List two features we used from the C++ standard library, including a short explanation of why you would use the feature and which header file must be included. Example: The std::cin object is found in the iostream header file and is used to read characters from the keyboard.arrow_forwardPlease I need help to get this homework done, I am not sure how to build the program correctly.arrow_forwardI need help making some C++ code. It needs to ask the user to enter their monthly cost for their rent or mortgage payment, phones, internet, cable, and utility bills. Then I need it to display the monthly cost of these expenses and the annual cost.arrow_forward
- How do you pass a file as a command line argument to a C++ program?arrow_forwardOnly use given directions, no extra code needed. Thank you!arrow_forwardMake C++ program.Your travel agency offers trips to Asian and African countries. This month, you are specifically doing trips to the Philippines (in Asia) and Tunisia (in Africa) and created a program for users to get prices and a boarding ticket. For all Asian countries, you store the name and population information in your program. With African countries, in addition to the name and population, you are also interested in location (North, South, East, West). Create an abstract Country class that holds the country name and population (given by the constructor). There should be two functions: int get_ticket_price and void_print_boarding_pass (which will output a boarding pass as a file-see below) Using the Country class, create two classes called African_country and Asian_country. The Asian_country class should use the same constructor that the Country class uses and the African_country class constructor should allow for the user to enter the location (see sample run)....arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education