
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
![Programming in C
Lab#03
2. Write a function that has the following prototype:
int Equalcols (int *A, int rows, int cols);
The function should return the value 1 if the sums of the values in each column are the
same and 0 otherwise. For example:
For the matrix:
1 2 0 3
2 3 2 1
3 1 4 2
The value 1 is returned since the sums of the values in each column are the same (each
column sum is equal to 6), while for the matrix:
2 4 3 2
2 3 4 1
1 35 2
The value 0 is returned since the sums of the values in each column are not equal.
Write a function that takes a pointer to a two dimensional array, number of rows and
number of columns as arguments. The function should read the elements of the matrix
from the user and store them in the two dimensional array using pointer offset
notation.
Write a main program that makes use of the functions above to:
Read a matrix from the user, where the number of rows and number of columns
should be input from the user. The maximum dimensions of the matrix are 10x10.
Print a message stating whether the sums of the values in each column in the matrix
are equal or not.
Use only pointer offset notation to complete this program. You are not allowed to use
any subscript notation ([]) at any time in the program.](https://content.bartleby.com/qna-images/question/3acbceed-9e6e-4759-a213-505a8480b31b/0f90f686-3fcb-49b9-adac-908486c62357/6zdwid_thumbnail.png)
Transcribed Image Text:Programming in C
Lab#03
2. Write a function that has the following prototype:
int Equalcols (int *A, int rows, int cols);
The function should return the value 1 if the sums of the values in each column are the
same and 0 otherwise. For example:
For the matrix:
1 2 0 3
2 3 2 1
3 1 4 2
The value 1 is returned since the sums of the values in each column are the same (each
column sum is equal to 6), while for the matrix:
2 4 3 2
2 3 4 1
1 35 2
The value 0 is returned since the sums of the values in each column are not equal.
Write a function that takes a pointer to a two dimensional array, number of rows and
number of columns as arguments. The function should read the elements of the matrix
from the user and store them in the two dimensional array using pointer offset
notation.
Write a main program that makes use of the functions above to:
Read a matrix from the user, where the number of rows and number of columns
should be input from the user. The maximum dimensions of the matrix are 10x10.
Print a message stating whether the sums of the values in each column in the matrix
are equal or not.
Use only pointer offset notation to complete this program. You are not allowed to use
any subscript notation ([]) at any time in the program.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 2 images

Knowledge Booster
Similar questions
- Write VBA CODE FOR THE FOLLOWING PROBLEM Problem: The Worksheet named Grades contains a place for students to record the grades they have received in their classes. Students put the number of each letter grade received in the B column. (For example, the worksheet currently shows that the student has taken 9 classes and made five As, one B, one C, one D, and one F as grades. You need to write a program that reads the grades from the worksheet and uses a function to calculate the student’s GPA. For this problem you can assume that all classes are worth the same number of credit hours. The function should send back the GPA to the calling procedure. The procedure will then put up a message box that gives the student their GPA and a message about their GPA, all in one message box. The message should be “You qualify for an internship” if the student has a GPA of at least 3.0. It should be “You’re in the danger zone” if the GPA is between 2.0 and 3.0. And it should be “You are on…arrow_forwardwrite a function sumValues which has two formal paramerters. int num1 and int num2. The function sums the values from num1 to num2 inclusive and returns the sumarrow_forwardIn c++ Write a function heading and body for a float function called ConeVolume that takes two value float parameters called radius and height. The function computes and returns the volume of a cone using the following formula:arrow_forward
- A Circle and Two Squares Imagine a circle and two squares: a smaller and a bigger one. For the smaller one, the circle is a circumcircle and for the bigger one, an incircle. Create a function, that takes an integer (radius of the circle) and returns the difference of the areas of the two squares. Examples square_areas_difference (5) → 50arrow_forwardGame of Hunt in C++ language Create the 'Game of Hunt'. The computer ‘hides’ the treasure at a random location in a 10x10 matrix. The user guesses the location by entering a row and column values. The game ends when the user locates the treasure or the treasure value is less than or equal to zero. Guesses in the wrong location will provide clues such as a compass direction or number of squares horizontally or vertically to the treasure. Using the random number generator, display one of the following in the board where the player made their guess: U# Treasure is up ‘#’ on the vertical axis (where # represents an integer number). D# Treasure is down ‘#’ on the vertical axis (where # represents an integer number) || Treasure is in this row, not up or down from the guess location. -> Treasure is to the right. <- Treasure is to the left. -- Treasure is in the same column, not left or right. +$ Adds $50 to treasure and no $50 turn loss. -$ Subtracts…arrow_forwardHi please do asap in given term.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY