1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <iostream>
using namespace std;
int F1(short array1[], short array2[], int count1, int count2);
int main()
{
short ARRAY1[3] = { 1, 2, 3};
short ARRAY2[3] = {1, 2, 3};
int total;
total = F1(ARRAY1, ARRAY2, 3, 3);
cout << "The total is " << total << endl;
system("pause");
return 0;
}
int F1(short array1[], short array2[], int count1, int count2)
{
int total = 0,x=0,y=0;
for(int count = 0; count < count1; count++)
x+=array1[count];
//{
for(int count = 0; count < count2; count++)
y+=array2[count];
//total += array1[count] + array2[count];
//}
return total=x+y;
}
|