Answered # Simple Matrix Multiplication

arkoenig 340 Discussion Starter JordanHam -2 Discussion Starter JordanHam -2 Discussion Starter JordanHam -2 Discussion Starter JordanHam -2 jonsca 1,059 Discussion Starter JordanHam -2 Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

0

What have you tried so far? Why doesn't it work? What sort of trouble are you having?

0

```
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System::IO;
using namespace System;
void func(double t[], int n)
{
for (int w=0; w<10; w++)
Console::WriteLine(t[w]);
}
int _tmain()
{
String* path = "DailyReport(2).csv";
String* MRVF= "Merrill - Valley Farms";
//create array of times of outages
//n = number of outages
const int n=10;
double t[n]={15.70, 29.39, 41.14, 56.47, 75.61, 98.83 ,112.42, 125.61, 129.39, 133.45};
int num[n];
for (int i=0; i<n; i++)
num[i]=i;
for (int j; j<10;j++)
Console::WriteLine(num[j]);
func( t, n);
return 0;
```

I will have a program that searches a CSV, creates an array from some data and then I want to pass those arrays to a function to take the ln of them. But I cannot find any sort of syntax on how to do this.

0

```
int Array[2]={4,4};
int Array2[2] = {log,5};
int result[2] = {};
result[0] = Array[0]*Array2[0];
result[1] = Array[1]*Array2[1];
Console::WriteLine(result[0]);
```

something like that but not sure what to do with the log or ln part

0

Nevermind I got it

```
double t[n]={15.70, 29.39, 41.14, 56.47, 75.61, 98.83 ,112.42, 125.61, 129.39, 133.45};
for (int count =0; count <=n; count++)
{
double a= t[count];
double c= log(a);
Console::WriteLine(c);
}
```

0

```
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#include <math.h>
#using <mscorlib.dll>
using namespace System::IO;
using namespace System;
//function declaration
void FindLN(double t[], int n);
int _tmain()
{
String* path = "DailyReport(2).csv";
String* MRVF= "Merrill - Valley Farms";
//create array of times of outages
//n = number of outages
const int n=10;
double t[n]={15.70, 29.39, 41.14, 56.47, 75.61, 98.83 ,112.42, 125.61, 129.39, 133.45};
FindLN( t);
return 0;
}
void FindLN(double t[n])
{
int index;
for (index=0; index<n; index++)
double lnt[n]= log(t[index]);
Console::WriteLine(lnt[index]);
}
```

Someone wanna tell me why this doesnt work

0

What is not working about it? What output are you getting and what is your expected output?

I suspect you are expecting both statements after your for loop to be executed at each step, but in reality only the one immediately following the for loop is executed each time. Put a set of { } around it.

Edit: just found your other thread

*Edited 5 Years Ago by jonsca*: n/a

0

I ended up making the function statement much larger and not having to return the array but it gave me errors. And I still do not know how to do it, cant seem to get it right. Could be helpful for others if anyone wants to solve it.

This question has already been answered. Start a new discussion instead.

Recommended Articles

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

```
public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}
```

the function that I created to find the ...