C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 17th, 2012, 01:15 PM
boriana_grb boriana_grb is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 3 boriana_grb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 34 sec
Reputation Power: 0
General - Help with a course assigment-matrices

Hello, my course assigment is:
Given the 2-dimensional arrays (matrices) X and Y

a) if X,Y are both of size M by M, swap each even row of X with the column in Y of the same number.

b)if X,Y are both of size M by N, compute the matrx Zo=X+Y

c) if X is M by N and Y is N by P, compute Q=M*N

I would be glad if someone can help me.

Reply With Quote
  #2  
Old December 19th, 2012, 12:50 AM
boriana_grb boriana_grb is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 3 boriana_grb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 34 sec
Reputation Power: 0
We work with Microsoft visual C++. I have started a) but I don`t know how to swap the even rows/colums.Here is what I have done so far.
#include<iostream.h>
#include<math.h>
double X[50][50];
double Y[50][50];
double Z[50][50];
int M,N,P,Q,S,k,i,j;

main () {
cout<<"Broi redove i stulbove v matr.X=";
cin>>M;


for (i=0;i<M;i++)
for (j=0;j<M;j++) { if (i%2==0){
cout<<"X["<<i<<"]["<<j<<"]=";
cin>>X[i][j];}
}


for (i=0;i<M;i++)
for (j=0;j<M;j++) {if (j%2==0){
cout<<"Y["<<i<<"]["<<j<<"]=";
cin>>Y[i][j];}}



return 0;
}

Reply With Quote
  #3  
Old December 19th, 2012, 05:06 AM
boriana_grb boriana_grb is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 3 boriana_grb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 34 sec
Reputation Power: 0
In C++ language

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > General - Help with a course assigment-matrices


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap