C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
In Python Please
If you roll a pair of dice, you can get anywhere from 2 to 12. Write a program that uses a function to check if the input is a valid number from rolling two dice.
Create a technique for reducing two counts from 10,000 to 1 and then displaying their
values on the computer screen. To minimize the number of counters, your program
will employ a function.
Using Python
Chapter E Solutions
C++ How to Program (10th Edition)
Knowledge Booster
Similar questions
- Using VBA program and using excel Write a function which takes as input a planet name and returns a message as follows: If the planet is not on the list then return “Pick another planet”. If the temperature is less than -80 or greater than +80, or the oxygen level is less than 10, or the radiation level is Lethal, return “x is not habitable” where x is the name of the planet. If the temperature is between 0 and 30, the oxygen level is at least 20, and the radiation level is None, return “x is ideal” where x is the name of the planet. Otherwise return “x is habitable, but not ideal” where x is the name of the planet.arrow_forwardTask 03 Write a python program that takes 2 strings in lowercase as input from the user. 1) First string with a length greater than 2 and less than 5 2) second string with a length greater than 5 After taking the inputs, pass these values as arguments to the function. Your function calculates the summation of the ASCII values of each of the given strings and generates a number according to the following formula. random_number= (summation of ASCII value of string 1% length of 2nd string) + (summation of ASCII value of string2% length of 1st string) For any invalid inputs and your function should print "Invalid input". Otherwise, calculate the random number and print the statements from the following table. 5-8 9-12 Any other number Input "abc" "efghijk" Function Call: function name("abc", "efghijk") Output: Ciao ================================== Input "efghijk" "Abc" Random number Function Call: function_name("efghijk", "abc") Ciao Hello Hola Explanation: Here, "abc" is the string1,…arrow_forwardUsing Pythonarrow_forward
- Mat lab Write a function to take a number and display the numbers using a loop.Hint: You need to use input().Sample Input : 5 Sample Output: : 11 21 2 31 2 3 4 1 2 3 4 5arrow_forward(Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point numbers with random numbers that have been scaled to the range 1 to 100. Then determine and display the number of random numbers having values between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?arrow_forwardPlease use Pythonarrow_forward
- In Python lang. ONE Generate a random number between 1 and 100. That will be the number that the user should guess. Please print the random number. Generate a random number by using the random.randint function Try several times to check that the number produced is random. TWO: 0010 Create a variable and ask the user to input a number. Ask the user to input a number in a variable that will be rewritten every time the user inserts a number and Enforce the rules: Enforce that the input is a digit from 1 to 100. Give feedback to the user if the number needs to meet the rule. Allow the user to input the number again. If the number meets the rules, convert the input [a string] into an integer and evaluate if the guessed number is the same as the randomly generated number FOUR: Evaluate if the randomly generated number is the same that the number input by the user. FIVE: Use the dictionaries that you created for faculty members. Be sure that all the dictionaries have the same keys:…arrow_forwardb) Write a program to read a sentence and replace lowercase characters by uppercase and vice-versa.arrow_forwardYou are tasked with writing a program to process students’ end of semester marks. For each student you must enter into your program the student’s id number (an integer), followed by their mark (an integer out of 100) in 4 courses. A student number of 0 indicates the end of the data. A student moves on to the next semester if the average of their 4 courses is at least 60 (greater than or equal to 60). Write a program to read the data and print, for each student: The student number, the marks obtained in each course, final mark of the student (average of all the marks), their final grade (A,B,C,D or F) and whether or not they move on to the next semester. In addition, after all data entry is completed, print The number of students who move on to the next semester and the number who do not. The student with the highest final mark (ignore the possibility of a tie). Grades are calculated as follows: A = 70 and over, B = 60 (inclusive) -70, C = 50(inclusive)-60 D =…arrow_forward
- using C language, create a function to determine if a number is prime. The function will return 1 if it is prime, or 0 otherwise. Use one int argument, and use a simple loop to determine if a number is prime.arrow_forwardTrue or False? In a VBA macro you have the following statements: Dim word As String Dim x As Integer word = "kodak" x = 1 If Left(word,2) = Right(word,2) Then x = x + 1 Else x = x - 1 End If MsgBox word & x Suppose "kodak" is replaced by "kayak". Then this macro will display "2"arrow_forwardPLEASE ONLY USE PYTHON 3arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr