New concepts or language features you may use: library functions and random number generation. You always...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
New concepts or language features you may use: library functions and random number generation. You always create a separate C++ file for each program you write in lab. 1. Write a C++ program that does the following: a. Create a C++ file with the name problem1.cpp. b. Prompt the user for a positive integer greater than or equal to 10, validating the input until the user enters a positive integer greater than or equal to 10. c. Print a random integer between 1 and the user's integer. Sample run of the program: Enter an integer greater than or equal to 10: 7 Invalid input! Try again: 11 Random integer between 1 and 11 is 9. 2. Write a C++ program that does the following: a. Create a C++ file with the name problem2.cpp. b. Prompt the user for two positive integers, where the difference between the two integers must be at least 10, validating the input until the user enters two positive integers whose difference is at least 10. c. Print a random integer from the range of the smaller integer to the larger integer. Sample run of the program: Enter two positive integers with a difference of at least 10: -1 15 Invalid input! Try again: 59 Invalid input! Try again: 15 39 Random integer between 15 and 39 is 23. 3. Write a C++ program that does the following: a. Create a C++ file with the name problem3.cpp. b. Prompt the user for a positive integer, which is the number of die rolls simulated, printing Not playing games. and terminating the program if the user enters an invalid integer. c. Use a loop to simulate n die rolls, where for each die roll, print the roll number and the simulated die roll value. d. After the last die roll, print the total count of ones rolled. Sample run of the program: Enter the number of die rolls: 5 Roll 1: 2 Roll 2: 3 Roll 3:6 Roll 4: 1 Roll 5: 2 Total number of ones rolled: 1. New concepts or language features you may use: library functions and random number generation. You always create a separate C++ file for each program you write in lab. 1. Write a C++ program that does the following: a. Create a C++ file with the name problem1.cpp. b. Prompt the user for a positive integer greater than or equal to 10, validating the input until the user enters a positive integer greater than or equal to 10. c. Print a random integer between 1 and the user's integer. Sample run of the program: Enter an integer greater than or equal to 10: 7 Invalid input! Try again: 11 Random integer between 1 and 11 is 9. 2. Write a C++ program that does the following: a. Create a C++ file with the name problem2.cpp. b. Prompt the user for two positive integers, where the difference between the two integers must be at least 10, validating the input until the user enters two positive integers whose difference is at least 10. c. Print a random integer from the range of the smaller integer to the larger integer. Sample run of the program: Enter two positive integers with a difference of at least 10: -1 15 Invalid input! Try again: 59 Invalid input! Try again: 15 39 Random integer between 15 and 39 is 23. 3. Write a C++ program that does the following: a. Create a C++ file with the name problem3.cpp. b. Prompt the user for a positive integer, which is the number of die rolls simulated, printing Not playing games. and terminating the program if the user enters an invalid integer. c. Use a loop to simulate n die rolls, where for each die roll, print the roll number and the simulated die roll value. d. After the last die roll, print the total count of ones rolled. Sample run of the program: Enter the number of die rolls: 5 Roll 1: 2 Roll 2: 3 Roll 3:6 Roll 4: 1 Roll 5: 2 Total number of ones rolled: 1.
Expert Answer:
Answer rating: 100% (QA)
1 C program to generate a random integer between 1 and n where n is an integer greater than or equal ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
It takes the same amount of time to double all three accounts ($100, $200, $500). All three accounts take 13.863 to double. What can we determine about the starting amount and doubling time?
-
The cost to submit a bid is $300,000, so communities must be diligent in determining whether or not to bid. Prior to bidding, what would a host community undertake to make sure that benefits will...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
After its move in 1990 to La Junta, Colorado, and its new initiatives, the DeBourgh Manufacturing Company began an upward climb of record sales. Suppose the figures shown here are the DeBourgh...
-
Consider three equally spaced line sources m placed at (x, y) = (+a, 0), (0, 0), and (−a, 0). Sketch the resulting streamlines and note any stagnation points. What would the pattern look like...
-
In problem 1-5, find the limits. 1. 2. 3. 4. 5. lim x2 im lim linn (x-5)(3-x)
-
Explain with a neat sketch, the working of a single acting piston pump.
-
Project Analysis McGilla Golf has decided to sell a new line of golf clubs. The clubs will sell for $700 per set and have a variable cost of $320 per set. The company has spent $150,000 for a...
-
Losing to a Weaker Foe What began as a heavily conventional military campaign to unseat the regime of Saddam Hussein had become a bitter, unconventional struggle against frustrated Sunnis who...
-
Green Planet, Inc., a manufacturer of air filter systems for industrial facilities, is considering the addition of a new system to its current product line. The following data has been forecasted: ...
-
Insomniac records is a record label specializing in underground music artists. Each year, Insomniac records total earnings are taxed at the current corporate tax rate, and then taxed as personal...
-
A company uses sandpaper in its production process. How is the cost of the sandpaper classified?
-
Of the 40 theater performances that a critic reviewed, 21 were comedies. She gave favorable reviews to 6 of the comedies and unfavorable reviews to 5 of the non-comedies. a. Complete the two-way...
-
Define "bad debt expense" and explain how to calculate it 2) Explain valuation methods for different categories of inventory.
-
At the conclusion of a program evaluation, policy analysts often provide recommendations to legislative bodies for review. How significant is public input in the acceptance of these recommendations?
-
Using the Terminal Tutorial as a guide, assess the potential impact of the merger on Disney as of the end of 2018. What is the net impact? Is it accretive or dilutive? By how much?
-
Chelsea purchased a machine for $26,000 for his company. He paid 5.00% of this amount as a down payment and financed the rest at 6.02% compounded monthly. He paid $1,125 at the end of every month to...
-
Find the reduced echelon form of each of the matrices given in Problems 120. c 1 26 + 4
-
During 2012, Palo Fiero purchases the following property for use in his manufacturing business: Palo uses the accelerated depreciation method under MACRS, if available, and does not make the election...
-
Sherry rents her vacation home for 6 months and lives in it for 6 months during the year. Her gross rental income during the year is $4,000. Total real estate taxes for the home are $950, and...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family. Ivan and Irene have the following investment income, in addition to that reported in Chapter 1: Dividends...
-
Use SecureRandom method ints to generate a stream of 50 random numbers in the range 1 to 999, then filter the resulting stream elements to select only the odd numbers and display the results in...
-
What percentage of the 9,449 survey respondents live in the Eastern part of the county?
-
(a) What percentage of those not completing high school were females? (b) What percentage of those not completing high school were males? (c) What percentage of those completing high school were...
Study smarter with the SolutionInn App