int arr[]={4,5,6,8,1,6,4,7,1,2};
and I want and array to equal the ln of those values in an array? I dont why I am having so much trouble with this. Thanks!
int arr[]={4,5,6,8,1,6,4,7,1,2};
and I want and array to equal the ln of those values in an array? I dont why I am having so much trouble with this. Thanks!
What have you tried so far? Why doesn't it work? What sort of trouble are you having?
#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.
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
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);
}
// 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
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
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.