what's the solution for the c++ project?
Answer 1:
Output will be:
List elements: 6 10 14 18 26
Explanation:
Initially given alpha[0]=4;
then for count = 1;
alpha[count]=4*count+10; //alpha[1] = 4* 1 + 10 = 14
alpha[count-1]=alpha[count]-8; //alpha[0] = alpha[1] - 8 = 14 - 8 = 6; final value of alpha[0] will be 6
for count = 2;
alpha[count]=4*count+10; //alpha[2] = 4* 2 + 10 = 18
alpha[count-1]=alpha[count]-8; //alpha[1] = alpha[2] - 8 = 18 - 8 = 10; final value of alpha[1] will be 10
for count = 3;
alpha[count]=4*count+10; //alpha[3] = 4* 3 + 10 = 22
alpha[count-1]=alpha[count]-8; //alpha[2] = alpha[3] - 8 = 22 - 8 = 14; final value of alpha[2] will be 14
Similarly we can calculate for count = 4 and count = 5 and can find alpha[3], alpha[4].
When we print the value for array alpha[5] then it will print 6 10 14 18 26
Answer 2:
Valid calls are:
a) sum(a, b, c);
output would be: c = 15
b) sum(list1[0],list2[0], c);
output would be: c = 3
because list1[0] = 1, list2[0] = 2
c) is not valid call
It would give error
error: no matching function for call to 'sum'
d)
for(int i=1; i<3; i++)
{
sum(list1[i], list2[i], c);
cout<<"c = "<<c<<endl;
}
Output would be:
c = 5
c = 7
because sum(list1[1], list2[1], c); means sum(2, 3, c) yields c = 5
and sum(list1[2], list2[2], c); means sum(3, 4, c) yields c = 7
Please give thumbsup, if you like it. Thanks.
PART1 Answer the following question in a Word document named as SP2019LAB7 PART1 YourlastName.doc...