Write an interactive C program whose input is a series of 12
Solution
#include <fstream>
 #include <iostream>
 using namespace std;
int main()
 {
    float a,b,c,d,e,f,g,h,i,j,k,l,m;
    ofstream tempdata;
   
    tempdata.open(\"tempdata.dat\");
   
    cout<<\"Please enter 12 temperatures:\"<<endl;
    cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j>>k>>l;
     tempdata<<a<<\"\\t\"<<endl
             <<b<<\"\\t\"<<b-a<<\"\\t\"
             <<c<<\"\\t\"<<c-b<<\"\\t\"
             <<d<<\"\\t\"<<d-c<<\"\\t\"
             <<e<<\"\\t\"<<e-d<<\"\\t\"
             <<f<<\"\\t\"<<f-e<<\"\\t\"
             <<g<<\"\\t\"<<g-f<<\"\\t\"
            <<h<<\"\\t\"<<h-g<<\"\\t\"
             <<i<<\"\\t\"<<i-h<<\"\\t\"
             <<j<<\"\\t\"<<j-i<<\"\\t\"
             <<k<<\"\\t\"<<k-j<<\"\\t\"
             <<l<<\"\\t\"<<l-k<<\"\\t\"<<endl;
           
    tempdata.close();
    m=(a+b+c+d+e+f+g+h+i+j+k+l)/12.0;
    cout<<\"The average temperature is:\"<<m<<endl;
   
    return 0;
           
   
 }
tempdata.dat
34.5
 38.6 4.1
 42.4 3.8
 46.8 4.4
 51.3 4.5
 63.1 11.8
 60.2 -2.9
 55.9 -4.3
 60.3 4.4
 56.7 -3.6
 50.3 -6.4
 42.2 -8.1

