#include<iostream.h>
#include<fstream.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int n;
cout<<"enter your queue size:";
cin>>n;
int ub,lb=0;
cout<<"Enter your upper bound:";
cin>>ub;
int queue[3];
int head;
cout<<"Enter your head:";
cin>>head;
int temp,len=0,i,j;
for(i=0;i<n;i++)
{
cout<<"enter value for queue:";
cin>>queue[i];
}
prev=head;
for(i=0;i<n;i++)
{
temp=abs(prev-queue[i]);
len=len+prev;
prev=queue[i];
}
cout<<endl<<"total ::";
cout<<len;
return 0;
}
ALSO YOU CAN SEE FOLLOWING PROGRAMS:-
#include<fstream.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int n;
cout<<"enter your queue size:";
cin>>n;
int ub,lb=0;
cout<<"Enter your upper bound:";
cin>>ub;
int queue[3];
int head;
cout<<"Enter your head:";
cin>>head;
int temp,len=0,i,j;
for(i=0;i<n;i++)
{
cout<<"enter value for queue:";
cin>>queue[i];
}
prev=head;
for(i=0;i<n;i++)
{
temp=abs(prev-queue[i]);
len=len+prev;
prev=queue[i];
}
cout<<endl<<"total ::";
cout<<len;
return 0;
}
ALSO YOU CAN SEE FOLLOWING PROGRAMS:-
No comments:
Post a Comment