array multiplication task
Posted
by
toby
on Stack Overflow
See other posts from Stack Overflow
or by toby
Published on 2012-12-03T22:40:50Z
Indexed on
2012/12/03
23:04 UTC
Read the original article
Hit count: 136
I am tying to get around how you will multiply the values in 2 arrays (as an input) to get an output. The problem I have is the how to increment the loops to achieve the task shown below
#include <iostream>
using namespace std;
main ()
{
int* filter1, *signal,fsize1=0,fsize2=0,i=0;
cout<<" enter size of filter and signal"<<endl;
cin>> fsize1 >> fsize2;
filter1= new int [fsize1];
signal= new int [fsize2];
cout<<" enter filter values"<<endl;
for (i=0;i<fsize1;i++)
cin>>filter1[i];
cout<<" enter signal values"<<endl;
for (i=0;i<fsize2;i++)
cin>>signal[i];
/*
the two arrays should be filled by users but use the arrays below for test
int array1[6]={2,4,6,7,8,9};
int array2[3]={1,2,3};
The output array should be
array3[9]={1*2,(1*4+2*2),(1*6+2*4+3*2),........,(1*9+2*8+3*7),(2*9+3*8),3*9}
*/
return 0;
}
This is part of a bigger task concerning filter of a sampled signal but it is this multiplication that i cant get done.
© Stack Overflow or respective owner