Write the following functions:
Main: declare an array of size 7 with random numbers, call the following functions.
* PrintArray: prints the elements of the array.
* SumArray: Return the sum of elements of the array.

Recommended Answers

All 3 Replies

void PrintArray()
{
for(i=0;i<7;i++) //there could be a n which could be 7...
    cout<<v[i]<<' '; //v is your array
}

aaaand

unsigned SumArray()
{
unsigned Sum;
for(i=0;i<7;i++)
    S+=v[i];
return S;
}
Member Avatar for iamthwee

You need to provide proof of effort as this is a homework question.

^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.