QuestionQuestion

Assignment briefing: This assignment will assess your ability to solve a problem using C as a tool. You will be using these C programming elements: loops (e.g. for.. or while..), conditions (if statements), structures, two dimensional arrays, pointers and functions. Your task is to write a C program to:

• Allow the user to input the name and size of the two matrices to get multiplied. The contents of the matrix are read from the user (so for e.g., if the matrix is 3x2, the first 2 numbers are for the first row and the second 2 numbers are for the second row… and so on).
• Display the name and contents of the matrices to the screen
• Calculate the third matrix which the multiplication of the 2 entered by the user, if they can be multiplied.
• Display the name and the contents of the resulting matrix.
• The program should loop to read 2 matrices and find the result while giving the user a way to stop the program

The program shall define a structure to hold the information about the matrices as follows:
struct matrix


{

char name; // to hold the 1 character name of the matrix

float **mValues;// to hold the values in the matrix, up to 10 rows x 10 columns int nrows; // to hold the number of rows used in mValues int ncols; // to hold the number of columns used in mValues

};

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <stdio.h>
#include <string.h>
#include <malloc.h>

struct matrix
{
    char name; // to hold the 1 character name of the matrix
    float **mValues;// to hold the values in the matrix, up to 10 rows x 10 columns
    int nrows; // to hold the number of rows used in mValues
    int ncols; // to hold the number of columns used in mValues
};

// function used to read all characters until the end of line occurs
// used for discarding invalid inputs
void discardLine()...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$10.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats