
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
Question
thumb_up100%
![Write a print function that prints a matrix of rows rows and columns columns. It prints the floating point
numbers of each matrix row on one line, separated by a single space. The formatting of the float is a total
of 7 positions with an accuracy of 3 positions. The name character is the name of the array. Use the letter 'a'
for the command to print matrixA using this function.
#define MAXSIZE 10
void print (float matrix [MAXSIZE] [MAXSIZE], int rows, int columns, char name) { }
int main (void) {
print (matrixA, rows A, columns A, 'A');
}
A 3x3 matrix would be formatted like this:
Command? a
Matrix A (3 X 3):
1.000 0.000
0.000
0.000 1.000 0.000
0.000 0.000 1.000
Since the matrix matrixA has been initialised to a size of 1x1 with value 0 this should be the result of your
program:
Command? a
Matrix A (1 X 1):
0.000
Command? q
Bye!](https://content.bartleby.com/qna-images/question/0b36f4fe-6962-4315-bbea-02248ca00e23/3bea578b-a97e-4cfe-be8d-ffe3597bc442/lc39grv_thumbnail.png)
Transcribed Image Text:Write a print function that prints a matrix of rows rows and columns columns. It prints the floating point
numbers of each matrix row on one line, separated by a single space. The formatting of the float is a total
of 7 positions with an accuracy of 3 positions. The name character is the name of the array. Use the letter 'a'
for the command to print matrixA using this function.
#define MAXSIZE 10
void print (float matrix [MAXSIZE] [MAXSIZE], int rows, int columns, char name) { }
int main (void) {
print (matrixA, rows A, columns A, 'A');
}
A 3x3 matrix would be formatted like this:
Command? a
Matrix A (3 X 3):
1.000 0.000
0.000
0.000 1.000 0.000
0.000 0.000 1.000
Since the matrix matrixA has been initialised to a size of 1x1 with value 0 this should be the result of your
program:
Command? a
Matrix A (1 X 1):
0.000
Command? q
Bye!
Expert Solution

arrow_forward
Step 1
The code is given below with output screenshot
Happy Coding ?
Step by stepSolved in 4 steps with 3 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
- Prompt: In Python language, write a function that applies the logistic sigmoid function to all elements of a NumPy array. Code: import numpy as np import math import matplotlib.pyplot as plt import pandas as pd def sigmoid(inputArray): modifiedArray = np.zeros(len(inputArray)) #YOUR CODE HERE: return(modifiedArray) def test(): inputs = np.arange(-100, 100, 0.5) outputs = sigmoid(inputs) plt.figure(1) plt.plot(inputs) plt.title('Input') plt.xlabel('Index') plt.ylabel('Value') plt.show() plt.figure(2) plt.plot(outputs,'Black') plt.title('Output') plt.xlabel('Index') plt.ylabel('Value') plt.show() test()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_forwardDefine the array printed below using the np.array() function, and assign it to the variable 'my_array' (only one line of code needed). [[0, 2, 4],[9, -6, 5],[0, 0, -10]]arrow_forward
- a. Problem 1. Create an array of 30 random numbers that range between 1 and 100. Then, write a function that will receive a number from the user and determine if that number exists in the array or not. For instance, assume the array is: [2, 93, 14, 89, 12, 3, 81, 15, 14, 89, 52, 96, 71, 82, 5, 2, 41, 23, 52, 59, 44, 44, 88, 39, 49, 50, 97, 45, 48, 36] Now, assume the user enters 89, the program should output true. But, if the user enters 77, the program should output false. Approach: We will be implementing this method in two different ways. Both will be recursive. First, implement a method called findA (x,A), where x is the number we are looking for and A is an array. In the body of the function, compare x with the FIRST item that is in the array. If this first item is equal to X, return true. If not, remove the first item from A and call findA (x,A) on the revised list. If you call find on an empty list, you will want to return false. Writing any explicit loop in your code results a…arrow_forwardWrite a function that calculates the totals of the rows in a 2D array with 5 columns. Store the row totals into a separate 1D array. Pass both arrays into the function along with the number of rows in the 2D array.arrow_forward
arrow_back_ios
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