We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,078 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Matrix addition

 for i := 1 to n do
     for j := 1 to n do
         C[i, j] := A[i,j] + B[i, j]









#include <iostream>
#include <iomanip>
using namespace std;

int SIZE = 10;

double Sum(double matrixA[SIZE], double matrixB[SIZE])
{
int i = 0;
int j = 0;
double rows, columns;
double rows2, columns2;
double matrixC[SIZE][SIZE];

if(rows == columns2 && rows2 == columns)
{


for(i = 0; i < rows2; i++)
{
for(j = 0; j < columns2; j++)
{
{matrixC[i][j] = matrixA[i][j] + matrixB[i][j];




}
}
}
}

It's not quite the same. I'm not sure about the do loops here. Does anyody know? There's no output needed.

BTW. Would not let me post it without the pseudo code being in the "code" brackets.

2
Contributors
2
Replies
58 Minutes
Discussion Span
9 Months Ago
Last Updated
3
Views
XodoX
Junior Poster
105 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

It's not quite the same.

Meaning what, exactly? Are you doing a conversion but not sure your conversion is accurate? Are you getting errors when running it? Unexpected behavior? What's not right that you want fixed?

deceptikon
Challenge Accepted
Administrator
3,447 posts since Jan 2012
Reputation Points: 822
Solved Threads: 473
Skill Endorsements: 57

Never-mind. I think I got it. How do I exactly measure the time of the execution using System.currentTimeMillis() ? Can I use this one?

XodoX
Junior Poster
105 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.1074 seconds using 2.68MB