HI, im a newbie to C programming, having just started doing it as part of my course at uni, and have been set a project to write a C program to multiply two matrices of varying orders up to 4x4. So far ive pegged how to get the user to input the order of the matrices and from this create 3 arrays to store the matrix data. But now i have the problem of how do i code for the user to actually enter numbers into these arrays esp for diff size matrices, ideally im just looking for it printf out enter 1x2 1x2 etc. Secondly any hints on how to implement to matrix mulit formula into C would be apprciated. This is what i have so far, though not sure about my arrays
any help would be much appricaited,Code:#include <stdio.h> #define MATRIX_A #define MATRIX_B #define MATRIX_C int main() { int R = 0, C = 0, C2 = 0; printf("This program will multiply 2 matrices (up to the order or 4x4),and display the result\n"); do { printf("Enter the number of rows in matrix A\n"); scanf ("%d", &R); if (R>4) { printf("Number or rows too great\n"); } } while (R>4); do { printf("Enter the number of colums in matrix A\n"); scanf ("%d", &C); if (C>4) { printf("number of colums too great\n"); } } while (C>4); do { printf("Enter the number of colums in Matrix B\n"); scanf ("%d", &C2); if (C2>4) { printf("number of colums too great\n"); } } while (C2>4); int Matrix_A [R] [C] int Matrix_B [C] [C2] int Matrix_C [R] [C2]
thanks in advance
P.S did search about this but didnt find nething i could understand really, like i said im a total newbie![]()



LinkBack URL
About LinkBacks



