#include<iostream>
using namespace std;
class avg
{
int a[10],s,t,n,w,tt;
public:
void read();
void display();
void awt();
void att();
};
void avg::read()
{
cout<<"enter no of members at theatre counter \n";
cin>>n;
cout<<"enter number of tickets want to purchase \n";
for(int i=0;i<n;i++)
{
cout<<"a["<<i<<"]=";
cin>>a[i];
}
}
void avg::awt()
{ s=0;t=0;
for(int i=0;i<n-1;i++)
{
s=s+a[i];
t=t+s;
}
cout<<"sum of awt is="<<t<<"\n";
w=t/n;
}
void avg::att()
{
t=0;s=0;
for(int i=0;i<n;i++)
{
t=t+a[i];
s=s+t;
}
cout<<"sum of att is="<<s<<"\n";
tt=s/n;
}
void avg::display()
{
cout<<"no of tickets each person will purchase \n";
for(int i=0;i<n;i++)
cout<<"a["<<i<<"]="<<a[i];
cout<<"average waiting time is"<<w<<"\n";
cout<<"average turn over time is"<<tt<<"\n";
}
int main()
{
avg ob;
ob.read();
ob.awt();
ob.att();
ob.display();
return 0;
}
No comments:
Post a Comment