Solve me

Reply

Join Date: Nov 2005
Posts: 5
Reputation: taha umar is an unknown quantity at this point 
Solved Threads: 0
taha umar taha umar is offline Offline
Newbie Poster

Solve me

 
0
  #1
Dec 24th, 2005
[U]Problem Statement:

Write a program that adds two matrices A and B of order 2X4 and store the result in third matrix C and C is stored in a file “result.txt�. The program should take the values from the user in the matrices through a function input. The addition of the Matrices should be calculated through a function add. The resultant matrix should be written in the file through a function save. Also display the result in a good looking format on the screen in a function show() .
Design and Implementation:
You are required to make three functions named as:
input()
This function will read values in the two Matrices.
add()
This function will take the two Matrices as arguments and add them and the result will be stored in a third matrix.
save()
This function will take the resultant matrix as argument and saves it to a file.
show()
This function will display the resultant matrix on the screen.


Hint 1: A two dimensional array is known as matrix in mathematics.
Hint 2: show() and save() should be called from add() respectively.

Sample output:

The following prototypes for the respective functions can be used to implement the above mentioned problem:

void input();

void Add( int arr1[][] , int arr2[][] );

void show( int array3[][] );

void save( int arr3[][] );

Your output can be similar with the following:

Enter values for first A:
2
3
1
1
5
3
2
4
Enter values for B:
4
2
3
1
8
9
1
4
Matrix C is:

6 5 4 2

13 12 3 8
[/i] :eek:
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,362
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Solve me

 
0
  #2
Dec 24th, 2005
I must be near-blind or something because I don't see any of your code where you attempted to solve that problem youself :evil: Don't let that overwhelm you. Take the problem one step at a time and you will be able to solve it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC