I need assistance on a C program i can't seem to figure out.
-
prob2(): By using a pointer to pointer **A and the function calloc() allocate the memory for the 4x4 matrix A[][]. By using a pointer *b and the function malloc() allocate the memory for the 4-dimensional vector b[]. Read the components of A and b from the given input file matrix.dat. The last line of the input file contains the components of b. The rows of matrix A are the first four lines of the input file. Print the components of A[][] row by row, and the components of b[]. Using the function gauss() given in the lecture notes week9.txt, solve the system of linear algebraic equations A[][]*x[]=b[]. Print the components of the solution vector x[]. Calculate and print the length of this vector. Free the allocated memory.
-
Answer:
void prob2(void) { //printf("Put your solution for problem 2 here: "); char inputs[81]; int i, j, k, lines; double **A, *b, vec[4]; FILE *input; input = fopen("matrix.dat", "r"); while(fgets(inputs, 81, input) != NULL) { lines++; A = (double **)malloc(4*sizeof(double *)); for(i = lines; i
Tipuk at Answerbag.com Visit the source
Related Q & A:
- How Can I use .net dll in C program?Best solution by Stack Overflow
- Do I need to have a box for my 2 12'' JL audio subs or can they be mounted a different way?Best solution by Yahoo! Answers
- Is there a website where i can either download or play a program that will let me build a building, like?Best solution by Yahoo! Answers
- What can I take on a plane and what can't I?Best solution by Yahoo! Answers
- Is there a site where I can learn C++ easily?Best solution by Blurtit.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.