Problem I : What does the following programprint? #include <iostream.h> void mai
ID: 3615976 • Letter: P
Question
Problem I: What does the following programprint?
#include <iostream.h>
void main()
{ int row = 10, column;
while ( row >= 1 )
{
column = 1;
while ( column <= 10 )
{
if ( row % 2 ) cout <<"<";
else
cout << ">";
++column;
}
row -= 1;
cout << endl;
}
}
Q1: Writethe function PlacexA(x) that when invoked returns the location of xinto A, or –1 if
x is not in A.
Q2: Writethe function ReplacexyA(x,y) that when invoked replaces all theoccurrences of x
in A by y.
Q3: Writethe function SplitA(H,M) that when invoked splits A into twosubarrays H and M of
equivalent size (i.e, N/2 each).
Q4: Writethe function ReverseA() that when invoked reverses the elements ofthe array A.
Example: if A =
15 12 61 30 40 1 5 13 50 62
Then the call: ReverseA() produces
62 50 13 5 1 40 30 61 12 15
Problem III
Let A be an array of N*N elements declared as follows:
const intN=10; int A[N][N];
Q1: Writethe function AverageA() that when invoked returns the average ofthe elements of
A.
Average=(sum elements of A)/(number elements of A)
Q2: Writethe function ReplacexyA(x,y) that when invoked replaces all theoccurrences of x
in A by y.
Explanation / Answer
please rate - thanks CRAMSTER rule, 1 question per post this is 3. Please provide separate posts for the other questions question 1 prints 10 rows of 10 columns even numbered rows print 10 #include int main() { int row = 10, column; while ( row >= 1) //row starts at 10 and goes down to 1, so 10 rows are done {column =1; //columns count from 1 to 10 while ( columnRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.