i have finally got the array to add together, but i am having trouble passing them all for example i need to output it using i code line similar to
Code:
Sum = Add(a,b,ArrLength);
but i am unsure how to do this.
this is the code i have so far
Code:
#include <iostream>
using namespace std;
int Number(int a, int b);
int Add();
int main()
{
Add();
cout <<"Sum = " << Number(8,2) <<endl;
Sum = Add(a,b,ArrLength);
system ("pause");
}
int Number(int a, int b)
{
return a+b;
}
int Add()
{
int a[5]={1,2,3,5,10};
int b[5]={5,6,7,8,-1};
int ArrLength[5];
int i;
for (i=0; i<5; i++)
{
ArrLength[i]= a[i] + b[i];
cout <<ArrLength[i];
}
return ArrLength[5];
}
Can anyone see where i am going wrong?