Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ou array records bourly temperature of seven days of week For Declare a two dime

ID: 3810374 • Letter: O

Question


ou array records bourly temperature of seven days of week For Declare a two dimensional that and the element 23) example, the element 0, halds the temperature o values holds the temperature of Sunday at 23 hours. Write statemenis to fill out this array with 02. write declarations for wa functions same name overloadedy one calculates (and returns) the average of three ineegers and the other calculates (and returns the average of three double numbers. Also, write their definitions, Chnose the appropriate type for the return value Q3. write a recursive lunction thai has an integer input parameter (n and teturns o4, write statements to define an input stream and an output stream and associate them to the following files, respectively; in dat, oui dat Assume tbat in dat has eight integers d. 2. ...8) write statements (using random access to skip two integers and to read next two integets till the last item, then to write the sum of the integers to outdal. OS. Write the put produced by the following de. pl new int; 42 Page 1/2 court v

Explanation / Answer

Program:

#include <iostream>
using namespace std;

int main() {
int *p1,*p2,v;
v=24; // Here we are initializing value of v
p1=&v; // Here we are assigning value of v to p1 ( i.e p1=24 )
p2=p1; // Here we are assigning value of 1 to p2 ( i.e p2=24 ) so we can say that p2=&v
cout<<v<<" "<<*p1<<" "<<*p2<<endl; // Here we are printing values of v *p1 & *p2
p1=new int;
*p1=42; // Here we are updating value of *p1 as 42
cout<<v<<" "<<*p1<<" "<<*p2<<endl; // Here we are printing values of v , *p1 & *p2
*p2=*p1; // Here we are updating value of *p2 as value of *p1
cout<<v<<" "<<*p1<<" "<<*p2<<endl; // Here we are printing values of v , *p1 & *p2
v=4+2; // Here we are updating value of v as 6 so it updates value of *p2 also because p2=&v
cout<<v<<" "<<*p1<<" "<<*p2<<endl; // Here we are printing values of v , *p1 & *p2
}

Output:

24 24 24
24 42 24
42 42 42
6 42 6