Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 10, Problem 12E
Given the following declarations:
c
c
c
i
determine whether each p call from the following sets is valid and produces the same output as other calls from the set.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Implement the following function:
1) Name: GenerateRandom
2) Parameters: a (int), b (int), N (int)
3) Job: Generate and display N random numbers in the range [a – b] including a and b. The function will display the random numbers, display their sum and return the average of all random numbers.
The main() is provided. All you need is to implement the function GenerateRandom(). Note: Your output will be different because numbers are generated randomly.
use C++
Write two functions using the following headers:int generate01()void printMatrix(int n)The first function generates and returns a random number either 0 or 1.The second function prints an n-by-n matrix. Each element of the matrix is using the number generated by thefirst function.Write a test program that prompts the user to enter n and uses printMatrix to display an n-by-n matrix. Hereis a sample run:Enter n: 30 1 00 0 10 0 0
Write in C++
Alice is trying to monitor how much time she spends studying per week. She going through her logs, and wants to figure out which week she studied the least, her total time spent studying, and her average time spent studying per week. To help Alice work towards this goal, write three functions: min(), total(), and average(). All three functions take two parameters: an array of doubles and the number of elements in the array. Then, they make the following computations:
min() - returns the minimum value in the array
sum() - returns the sum of all the values in the array
average() - returns the average of all the values in the array
You may assume that the array will be non-empty.
Function specifications:
Function 1: Finding the minimum hours studied
Name: min()
Parameters (Your function should accept these parameters IN THIS ORDER):
arr double: The input array containing Alice's study hours per week
arr_size int: The number of elements stored in the array
Return Value:…
Chapter 10 Solutions
Programming in C
Ch. 10 - Type in and run the 15 programs presented in this...Ch. 10 - Write a function called to insert a new entry into...Ch. 10 - Prob. 3ECh. 10 - Write a function called r to remove an e from a...Ch. 10 - Prob. 5ECh. 10 - Prob. 6ECh. 10 - Prob. 7ECh. 10 - Prob. 8ECh. 10 - Prob. 9ECh. 10 - Prob. 10E
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Ship, CruiseShip, and CargoShip Classes Design a Ship class that the following members: A field for the name of...
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
True or False: You must have a return statement in a value-returning method.
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Find the error in the following pseudocode. Declare Integer value1, value2, value3, sum Set sum = value1 + valu...
Starting Out with Programming Logic and Design (4th Edition)
Explain how database administration tasks vary with the size and complexity of the database.
Database Concepts (7th Edition)
Suppose number is a variable of type int that has been given a value. Write a multibranch if- else statement th...
Java: An Introduction to Problem Solving and Programming (8th Edition)
In Exercises 3 through 24, carry out the task.
Create a button containing the word “PUSH” with the letter H as...
Introduction To Programming Using Visual Basic (11th Edition)
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
- [ ] [] power In the cell below, you are to write a function "power(list)" that takes in a list as its input, and then returns the power set of that list. You may assume that the input will not have any duplicates (i.e., it's a set). After compiling the above cell, you should be able to compile the following cell and obtain the desired outputs. print (power ( ["A", "B"]), power ( ["A", "B", "C"])) + Code + Markdown This should return [[], ["A"], ["B"], ["A", "B"]] [[], ["A"], ["B"], ["C"], ["A", "B"], ["A", "C"], ["B", "C"], ["A", "B", "C"]] (the order in which the 'sets' appear does not matter, just that they are all there) Python Pythonarrow_forwardPlease answer in C++ Zenny recently learned about Array and now answers Array's questions. She told her friend Zen about this. Zen wants to check how much Zenny knows about Array. So, give her the perfect number N. The task of Zenny is to find the sum of all the different positive number and different integers in the given list. As Zenny begins to solve problems she needs your help. Input 1 5 -1 1-10-2 Output 1-3arrow_forward#Solve it with C programing Suppose, you are working as a Data Entry Operator in a company. You have created a dataset that contains the names of N employees. Then your supervisor wants you to look for a particular employee by name. (Consider, every name in the data set is unique).Now your task is to write a program which will help you to find out the name which your supervisor is looking for.If found then print a message "Matched" otherwise print "Not Matched". (N.B: Without quotation) The first line of input will take an integer (N) which indicates the number of names in the dataset. Then the second line will take N space-separated strings. The third line of input will take another string as search value. Sample input:5rabbe sharif shazzad polash tutulsharif Sample output:Matched Sample input:4jahid nishat rasel shakibmunna Sample output:Not Matchedarrow_forward
- A. write a code to find the number of students who pass CS course, when their marks>=40 . As thelist has 85 students. B. wite a code to print this shape: *** *** **** C. Write a code to find the area and parameter of a Tringle; Area =1/2 * High * BaseParameter= S1+S2+ Basearrow_forwardExercise B: "Matrix Addition" For this exercise you will design and implement a function that takes two matrix arguments and computes their sum (if and only if a sum can actually be computed, returning an empty list otherwise). Two matrices can only be added together if they have exactly the same dimensions. If the dimensions are acceptable, then the matrix sum will have the same dimensions as either of the operands, and the value of each element in the matrix sum is itself the sum of the corresponding elements in the operand matrices. And although it does makes sense to test rectangularity before attempting addition, you need not perform this step (since you did it above). In order to complete this task, you will need to: ensure you know how matrix addition can be performed² ● Your submission for this exercise:arrow_forwardWrite a function that displays an n-by-n matrix using the following header: void printMatrix(int n)Each element is 0 or 1, which is generated randomly. Write a test program that prompts the user to enter n and displays an n-by-n matrix.arrow_forward
- Write a Template function body called swap( ) to swap the values of the two values of integer, doubles and character respectively using reference variables for swapping. (Write only template function body)arrow_forwardIn java there must be at least two calls to the function with different arguments and the output must clearly show the task being performed. (ONLY ARRAYS or ARRAYLIST) Develop a function that accepts an array and returns true if the array contains any duplicate values or false if none of the values are repeated. Develop a function that returns true if the elements are in decreasing order and false otherwise. A “peak” is a value in an array that is preceded and followed by a strictly lower value. For example, in the array {2, 12, 9, 8, 5, 7, 3, 9} the values 12 and 7 are peaks. Develop a function that returns the number of peaks in an array of integers. Note that the first element does not have a preceding element and the last element is not followed by anything, so neither the first nor last elements can be peaks. Develop a function that finds the starting index of the longest subsequence of values that is strictly increasing. For example, given the array {12, 3, 7, 5, 9, 8,…arrow_forwardThe distinction between void and NULL pointers is as follows: Make use of appropriate examples to support your response.arrow_forward
- **Python only pls** Problem A. that will help users purchase cookies. A user will input types of cookies and the number of cookies that they want, and your program will suggest how many boxes that they should order. There are 30 cookies per box, so your goal is to make sure that the user will buy enough boxes so that they will get the cookies that they want. Write a function cookie_order that takes a dictionary as a parameter containing cookie names as keys and numbers of those cookies as values. Have this function return a new dictionary that has cookie names and the number of boxes that should be purchased of each type. Hint: This means if someone wants 31 cookies, they need to buy 2 boxes of cookies of that type. You may want to consider using math.ceil for this problem. Examples: >>> cookie_order({'thin mints': 97}) {'thin mints': 4} >>> cookie_order({'thin mints':34, 'shortbread': 60, 'caramel delites': 71, 'peanut butter sandwich': 0}) {'thin mints': 2, 'shortbread': 2, 'caramel…arrow_forwardWrite a program in C++arrow_forwardonsider an input string TAM of letters ‘A’, ‘M’, and ‘T’. This string, which is given by the user, ends with ‘#’. It should be stored in a table (or array), called TAMUK. The number of each of these letters is unknown. We have a function, called SWAP(TAM,i,j), which places the ith letter in the jth entry of string TAM and the jth letter in the ith entry of TAM. Note that SWAP(TAM,i,j) is defined for all integers i and j between 0 and length(TAM)–1, where length(TAM) is the number of letters of TAM. 1. Using our algorithmic language, write an algorithm, called Sort_TAM, which sorts the letters in the array TAMUK in a way that all T’s appear first, followed by all A’s, and followed by all M’s. The algorithm Sort_TAM should have one parameter: The array TAMUK. Also, your solution is correct only if the following four constraints are satisfied: - Constraint 1: Each letter (‘A’, ‘M’, or ‘T’) is evaluated only once. - Constraint 2: The function SWAP(TAM,i,j) is used only when it is…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author: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
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License