Professional Documents
Culture Documents
Title: Function(reference,const,default)
Submitted to-
#include<bits/stdc++.h>
struct Time
int hour;
int minute;
int second;
};
struct employee
Time entry;
Time exit;
Time duration;
};
void display(employee x)
cout<<x.duration.hour<<":";
cout<<x.duration.minute<<":";
cout<<x.duration.second;
cout<<endl;
employee compute(employee x)
employee y;
int b,c,d,e;
b=9*3600;
c=x.exit.hour*3600+x.exit.minute*60+x.exit.second;
e=c-b;
if(e<0)
e= (e)+24*60*60;
b= e/3600;
c= (e-(b*3600))/60;
d= (e-(b*3600)-c*60);
y.duration.hour = b;
y.duration.minute=c;
y.duration.second=d;
return y;
employee y;
int b,c,d,e;
b=eh*3600+em*60+es;
c=exh*3600+exm*60+exs;
e=c-b;
if(e<0)
e= (e)+24*60*60;
}
b= e/3600;
c= (e-(b*3600))/60;
d= (e-(b*3600)-c*60);
y.duration.hour = b;
y.duration.minute=c;
y.duration.second=d;
return y;
cin>>x.exit.hour;
cin>>x.exit.minute;
cin>>x.exit.second;
int main()
employee x,dif,differ;
input(x);
dif = compute(x);
differ = compute(x.exit.hour,x.exit.minute,x.exit.second);
display(dif);
display(differ);
return 0;
}
Problem Number: 2
#include<bits/stdc++.h>
struct System
int feet;
float inches;
};
struct Room
System length;
System width;
};
cout<<"Area is "<<x<<endl;
float compute(Room x)
float a,b;
a = x.length.feet + (x.length.inches/12);
b = x.width.feet + (x.width.inches/12);
return (a*b);
}
float compute(float lf,float wf,float li=0,float wi=0)
float a,b;
a = lf + (li/12);
b = wf + (wi/12);
return (a*b);
Room x;
cout<<"Enter length"<<endl;
cin>>r.length.feet;
cin>>r.length.inches;
cout<<"Enter width"<<endl;
cin>>r.width.feet;
cin>>r.width.inches;
int main()
{
int i;
Room r;
float area,area2;
input(r);
area = compute(r);
display(area);
return 0;