# can u help me with this plz

R

given two square matrices A & B of size n. based on user selection,
preform one of the following operations:

* Note A={a b} inverse A^-1= (1/ad-be){d -b}
{c d} {-c a}

and thank u I

#### Ian Collins

given two square matrices A & B of size n. based on user selection,
preform one of the following operations:

* Note A={a b} inverse A^-1= (1/ad-be){d -b}
{c d} {-c a}

and thank u Show an attempt and you may get help, ask for homework to be done and
you will get abuse!

R

Show an attempt and you may get help, ask for homework to be done and

you will get abuse!

im a noob with c++ help me plz

this is my attempt
//
#include<iostream>
using namespace std;

void main()
{

float A, B , n;

}

R

#include<iostream>
using namespace std;

void main()
{
float A , B ;

cout<<"\nEnter matrix A:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
cin>>A[j];
}

cout<<"\nEnter matrix B:\n";
for(int i=0; i<2; i++)
{
for(int j=0;j<2;j++)
cin>>B[j];
}

for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]+B[j]<<"\t";
cout<<endl;
}

cout<<"\nSubtraction of matrix A&B:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]-B[j]<<"\t";
cout<<endl;
}

cout<<"\nMultiplication of matrix A&B:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]*B[j]<<"\t";
cout<<endl;
}

cout<<endl;
system("pause");
}

is this right answer im i missing some thing?
help plz

R

Show an attempt and you may get help, ask for homework to be done and

you will get abuse!

#include<iostream>
using namespace std;

void main()
{
float A , B ;

cout<<"\nEnter matrix A:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
cin>>A[j];
}

cout<<"\nEnter matrix B:\n";
for(int i=0; i<2; i++)
{
for(int j=0;j<2;j++)
cin>>B[j];
}

for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]+B[j]<<"\t";
cout<<endl;
}

cout<<"\nSubtraction of matrix A&B:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]-B[j]<<"\t";
cout<<endl;
}

cout<<"\nMultiplication of matrix A&B:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]*B[j]<<"\t";
cout<<endl;
}

cout<<endl;
system("pause");
}

is this the right answer ?
im i missing some thing?

D

#### David Brown

Show an attempt and you may get help, ask for homework to be done and

you will get abuse!

#include<iostream>
using namespace std;

void main()
{
float A , B ;

cout<<"\nEnter matrix A:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
cin>>A[j];
}

cout<<"\nEnter matrix B:\n";
for(int i=0; i<2; i++)
{
for(int j=0;j<2;j++)
cin>>B[j];
}

for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]+B[j]<<"\t";
cout<<endl;
}

cout<<"\nSubtraction of matrix A&B:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]-B[j]<<"\t";
cout<<endl;
}

cout<<"\nMultiplication of matrix A&B:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]*B[j]<<"\t";
cout<<endl;
}

cout<<endl;
system("pause");
}

is this the right answer ?
im i missing some thing?

Have you tried out your program? Does it work? Does it matter to you
that you have missed out half the question? Does it matter to you that
you are printing all the operations, not just the "user selected" one?
Does it matter to you that you don't know how to do matrix multiplication?

You also need to learn how to use Usenet (Google Groups mangles posts),
and how to write in English. It's fine to make a few mistakes with the
language - but it is /not/ fine to write SMS-speak, or fail to use basic
capitalisation and punctuation.

Once you've covered these points, and you again post your best effort at
solving the problem yourself, you will likely get more help.

O

#### Osmium

David Brown said:
rami wrote:

given two square matrices A & B of size n. based on user selection,

preform one of the following operations:

addition, subtraction, or multiplication of A & B.

Transpose of A & B .

Inverse of A or B only when n=2

* Note A={a b} inverse A^-1= (1/ad-be){d -b}

{c d} {-c a}

and thank u Show an attempt and you may get help, ask for homework to be done and

you will get abuse!

#include<iostream>
using namespace std;

void main()
{
float A , B ;

cout<<"\nEnter matrix A:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
cin>>A[j];
}

cout<<"\nEnter matrix B:\n";
for(int i=0; i<2; i++)
{
for(int j=0;j<2;j++)
cin>>B[j];
}

for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]+B[j]<<"\t";
cout<<endl;
}

cout<<"\nSubtraction of matrix A&B:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]-B[j]<<"\t";
cout<<endl;
}

cout<<"\nMultiplication of matrix A&B:\n";
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)

cout<<A[j]*B[j]<<"\t";
cout<<endl;
}

cout<<endl;
system("pause");
}

is this the right answer ?
im i missing some thing?

Have you tried out your program? Does it work? Does it matter to you
that you have missed out half the question? Does it matter to you that
you are printing all the operations, not just the "user selected" one?
Does it matter to you that you don't know how to do matrix multiplication?

You also need to learn how to use Usenet (Google Groups mangles posts),
and how to write in English. It's fine to make a few mistakes with the
language - but it is /not/ fine to write SMS-speak, or fail to use basic
capitalisation and punctuation.

Once you've covered these points, and you again post your best effort at
solving the problem yourself, you will likely get more help.

I agree with all of that!

You have a computer, use it.
http://en.wikipedia.org/wiki/Matrix_(mathematics)

R

rami wrote:

given two square matrices A & B of size n. based on user selection,

preform one of the following operations:

addition, subtraction, or multiplication of A & B.

Transpose of A & B .

Inverse of A or B only when n=2

* Note A={a b} inverse A^-1= (1/ad-be){d -b}

{c d} {-c a}

and thank u Show an attempt and you may get help, ask for homework to be done and

you will get abuse!
#include<iostream>

using namespace std;
void main()

float A , B ;
cout<<"\nEnter matrix A:\n";
for(int i=0; i<2; i++)

for(int j=0; j<2; j++)
cin>>A[j];

cout<<"\nEnter matrix B:\n";

for(int i=0; i<2; i++)

for(int j=0;j<2;j++)
cin>>B[j];

for(int i=0; i<2; i++)

for(int j=0; j<2; j++)
cout<<A[j]+B[j]<<"\t";

cout<<endl;

cout<<"\nSubtraction of matrix A&B:\n";

for(int i=0; i<2; i++)

for(int j=0; j<2; j++)
cout<<A[j]-B[j]<<"\t";

cout<<endl;

cout<<"\nMultiplication of matrix A&B:\n";

for(int i=0; i<2; i++)

for(int j=0; j<2; j++)
cout<<A[j]*B[j]<<"\t";

cout<<endl;
cout<<endl;
system("pause");

is this the right answer ?

im i missing some thing?

Have you tried out your program? Does it work? Does it matter to you

that you have missed out half the question? Does it matter to you that

you are printing all the operations, not just the "user selected" one?

Does it matter to you that you don't know how to do matrix multiplication?

You also need to learn how to use Usenet (Google Groups mangles posts),

and how to write in English. It's fine to make a few mistakes with the

language - but it is /not/ fine to write SMS-speak, or fail to use basic

capitalisation and punctuation.

Once you've covered these points, and you again post your best effort at

solving the problem yourself, you will likely get more help.

why are u people so mean T

#### Thomas Richter

Am 22.05.2014 14:47, schrieb (e-mail address removed):
why are u people so mean People are not mean, people just don't want to make *your* homework. The
point of homework assignments is to try it yourself. You don't learn
anything if you just type in the answer from somebody.

R

Am 22.05.2014 14:47, schrieb

People are not mean, people just don't want to make *your* homework. The

point of homework assignments is to try it yourself. You don't learn

anything if you just type in the answer from somebody.

help me to start the code and i will go ahead please O

#### Osmium

help me to start the code and i will go ahead please Debugging will be simpler if the matrix contains int, you can change it
later. I would defer the human interface to the end.

perhaps something like this.

#define N 2
int main()
{
int a[N][N] = {3, 4, 5, 6};
int b[N][N] ={37, 38, 39, 40};
iint c[N][N];
.stuff such as:
show(c);

Write a function to display a matrix for debugging purposes (show()). Get it
working to your satisfaction. Start writing functions for each of the
the harder stuff. Add a bit,
debug, verify results. . Remember that C++ arrays start with zero. Repeat
until done. Don't type a bunch of stuff, type as needed for the next few
minutes of debug. main will be pretty empty, basically the human interface
and function calls.

Change N to a variable. Add the human interface. main will be pretty empty,
basically the human interface and function calls. Done.

V

#### Victor Bazarov

help me to start the code and i will go ahead please Debugging will be simpler if the matrix contains int, you can change it
later. I would defer the human interface to the end.

perhaps something like this.

#define N 2
int main()
{
int a[N][N] = {3, 4, 5, 6};
int b[N][N] ={37, 38, 39, 40};
iint c[N][N];
.stuff such as:
show(c);
[..]

Change N to a variable. [..]

That's pretty non-trivial, and likely not feasible for an admitted
newbie. To OP: ignore this recommendation. If you can make it work for
fixed-size matrices, you'd get a passing grade.

V

S

#### Seungbeom Kim

why are u people so mean I don't think they are mean, but even if they were, they're
not obliged in any way to help you, but they are free to choose
whatever request to help. One of the most fundamental things
to remember when asking help in Usenet is that this is not
a customer support for a paid product, but a voluntary,
collaborative discussion forum. Therefore, you'd be better off
following the rules and etiquette to elicit help.

D

#### David Brown

why are u people so mean Anyone who provides you with code or more hints is doing you a
disfavour, and in the long run it will be worse for you and worse for
the rest of the world when yet another incompetent programmer cheats his
way through his homework and ends up in a job he is unable to do
something. And when you have something that is a solid attempt, people
here will try to give tips on how to improve it - but we will not do

And no matter what you end up doing in life - be it a C++ programmer or
something else - you will do it better if you learn to communicate in a
proper language. When you write like an adult, people will treat you
like an adult. When you write like a grumpy teenager, people will treat
you as one.

D

#### David Brown

help me to start the code and i will go ahead please You don't need help getting started - your start was fine (for homework
at this level). If you ask 10 people in this group how they would
structure the code for this problem, you'd get at least 12 different
write it - but you need to do more, such as testing, before anyone else

I

#### Ike Naar

help me to start the code and i will go ahead please Debugging will be simpler if the matrix contains int, you can change it
later. I would defer the human interface to the end.

perhaps something like this.

#define N 2
int main()
{
int a[N][N] = {3, 4, 5, 6};
int b[N][N] ={37, 38, 39, 40};
iint c[N][N];
.stuff such as:
show(c);
[..]

Change N to a variable. [..]

That's pretty non-trivial, and likely not feasible for an admitted
newbie. To OP: ignore this recommendation. If you can make it work for
fixed-size matrices, you'd get a passing grade.

If the implementation supports VLAs it's not so difficult.