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
Code the 100 locker problem.
Requirements
1. Only use printf statements in code
2. Must print out the final state of the array as a 10x10 array with clean formatting
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 3 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
- Direction: Complete the program below using case switch statement and single array with Function. Copy the source code and screen the sample output.PROGRAMMING //Single array - A group of consecutive memory locations of the same name and type, structures of related data items.//Array index always starts with zero.// Single array with function#include<iostream>using namespace std;// Function Nameint sumAll(int num[5]);void display(int num[5]);//Variable global declarationint x, sum=0, choice; int num[5];main(){// Save the input numbers to the memoryfor(x=0; x<=4; x++){ cout<<(" Enter a number: ");cin>>num[x];}cout<<"\nCHOICES: ";cout<<"\n 1.The sum of all numbers ";cout<<"\n 2. The sum of even subscripts"; cout<<"\n 3. The sum of even numbers ";cout<<"\n 4. The product of odd subscripts ";cout<<"\n 5. The product of odd numbers ";cout<<"\n 6. The highest number ";cout<<"\n 7. The lowest number ";cout<<"\n 8.…arrow_forwardHomework #2 Problem#1: 1. Create a 5 by 3 array of random integer numbers ranged from 0 to -90, 2. Find how many numbers that are divisible by 11 in the array? And specify their locations and store them in a separate array 3. Find the location of maximum and the minimum number in the array 4. Create a structure that consist of four fields, {array, max, min, sum} File in these fields with : o The array in #1. o Max: contains the index and the value for the maximum number in the array in #1 o Min: contains the index and the value for the maximum number in the array in #1 o Sum: the summation of the items inside the array in #1arrow_forwardWrite statements to do the following: a. i. Create an array, A, to hold 10 double values.ii. Assign the value 5.5 to the last element in the array, A iii. Display the sum of the first two elements of the array A.arrow_forward
- i need the answer quicklyarrow_forwardNeed fun Language code please. The Programs:- (File: count.fun) Write a program which counts from 1 to 10, printing each number on a line by itself. (File: array.fun) For this program you have two requirements: Create a function which takes two arguments, an array and the number of elements in the array. Have this function print the contents of the array, one entry per line. Have the program read in an array of 10 numbers. Next, reverse the contents of the array. Finally have your program print out the contents of the array, one per line.arrow_forward1- Write a user-defined function that accepts an array of integers. The function should generate the percentage each value in the array is of the total of all array values. Store the % value in another array. That array should also be declared as a formal parameter of the function. 2- In the main function, create a prompt that asks the user for inputs to the array. Ask the user to enter up to 20 values, and type -1 when done. (-1 is the sentinel value). It marks the end of the array. A user can put in any number of variables up to 20 (20 is the size of the array, it could be partially filled). 3- Display a table like the following example, showing each data value and what percentage each value is of the total of all array values. Do this by invoking the function in part 1.arrow_forward
- Warning ⚠️ Don't post AI generated answer or plagiarised answer. If I see these things I'll give you multiple downvotes and will report immediately.arrow_forwardProgram: Using a multidimensional array, create a triangular-shaped array. You will ask the user how many lines they want to see and then create the array, fill it, and then print it. You will fill the array with one 1 in the first row, two 2’s in the second row, etc. This should work for any integer that the user enters. (Just because I am starting on 1 does not mean row 0 was skipped.) You must: use a loop to create the array shape. You must: use nested for loops to fill the array and to print the values back to the screen. Your program should print as shown below. Example Output: How many lines would you like in your triangle? >>>9 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 If your code looks like the code below, it is not what I’m asking for. The code below is making a square multidimensional array, not a triangular one. The code below is just leaving certain spots empty so that it looks like a triangle. I will ask you…arrow_forwardAnswer The following a. Write the statement to declare an integer array alpha of size 95. b. Write the statement to initialize the array alpha to 0. c. What is the valid index range of alpha? d. Assign 20 to the fourth component of the array alpha. (Remember the array index starts at 0) e. Write the statement to print the values of the array alpha one per line. explain pleasearrow_forward
- Task 2: Write a C statements to accomplish the followings: 1. Define a 3 x 2 Array 2. Initializing the above Array 3. Access the element of the above array and Initialize them (element by element). 4. Setting the Elements in One Row to -2. 5. Averaging the Elements in the Array.arrow_forwardLanguage: C Topic: Arraysarrow_forwardSection A. Declare and initialize an array myChars containing the following characters: B, C, D, A, M, S and F.Remember to choose the correct data type for the array elements.Section B. Using a WHILE loop, output the elements of the array myChars so that they are displayed on thesame line and separated by a space. Use .length to get the length of the array.Section C. Change the last value of the array myChars to the letter X. Use .length in your code.Section D. Using a FOR loop, output the elements of the myChars array so that they are displayed on the sameline and separated by a dash (an extra dash at the end is okay). Use .length in your code.Section E. Declare an array of int of capacity 10 named thisArray.Section F. Use a FOR loop to populate the array thisArray with the following numbers 5, 10, 15, 20, 25. Thinkof a way to insert these numbers without actually writing “5” or “10” and so on, but by using the variable i ofyour FOR loop. NOTE that this is a partially-filled array and…arrow_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