Unit 3 : Array

Arrays are a fundamental data structure used to store a collection of elements of the same data type under a single variable name.

Syntax:  type arrayName [ arraySize ];

Exercise 5: Write a program to store daily temperatures for a week, and print the average temperature. 

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

float Temp[7],Sum_Temp=0.00, Avg_Temp = 0.00;

cout<<"Enter the temperature for each day : \n";

for(int i = 0;i<=7;i++)

cout<<"Day "<<i+1<":";

cin>>Temp[i];

}

for(int i = 0;i<=7;i++)

Sum_Temp = Sum_Temp + Temp[i]

}


Avg_Temp = Sum_Temp/7;

cout<<"The average temperature over a week is :" <<Avg_Temp;

getch();

}

Exercise 6: Write a program to carry out MATRIX addition and subtraction

Exercise 6: Implement a program to demonstrate String handling functions