#include <math.h>
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
#include<iomanip.h>
#include<string.h>
#include<conio.h>
void main ()
{
int x,y;
float rpm[100],miu, reff,e[100],de[100],u,u1,rpmf[100],r;
char jwb;
float miu1,miu2,miu3,miu4,z1,z2,z3,z4;
again :
clrscr();
cout<<"masukkan inputan referensi= "; cin>>reff;endl;
cout<<setiosflags(ios::right)<<setw(8)<<"RPM";
cout<<setiosflags(ios::right)<<setw(18)<<"EROR";
cout<<setiosflags(ios::right)<<setw(15)<<"DELTA EROR";
cout<<setiosflags(ios::right)<<setw(20)<<"RPMF" <<endl;
for (x=0; x<30; x++)
{
rpm[x]=rpm[x-1]+0.5*(e[x-1]);
for (y=1; y<13;y++)
{ rpm[0]=0;
rpm[y]=rpm[y-1]+10;
}
e[x] = reff-rpm[x];
de[x] = e[x]- e[x-1];
if (e[x] >=0)
{u = ((e[x]-0)/130);}
else
{u = ((0-e[x])/130);}
if (de[x] >=0)
{u1 = ((de[x]-0)/130);}
else
{u1 = ((0-de[x])/130);}
if (e[x] >=0 && de[x]>=0)
{
{ if (e[x]>de[x])
miu1=u1;
else
miu1=u;}
z1=-(rpm[x]*miu1);
}
if (e[x] >=0 && de[x]<=0)
{
{ if (e[x]>de[x])
miu2=u1;
else
miu2=u;}
z2=(rpm[x]*miu2);
}
if (e[x] <=0 && de[x]>=0)
{
{ if (e[x]>de[x])
miu3=u1;
else
miu3=u;}
z3=(rpm[x]*miu3);
}
if (e[x] <=0 && de[x]<=0)
{
{ if (e[x]>de[x])
miu4=u1;
else
miu4=u;}
z4=-(rpm[x]*miu4);
}
r=(z1*miu1+z2*miu2+z3*miu3+z4*miu4)/(miu1+miu2+miu3+miu4);
rpmf[x]=rpm[x]-r;
cout<<setiosflags(ios::right)<<setw(8)<<rpm[x];
cout<<setiosflags(ios::right)<<setw(18)<<e[x];
cout<<setiosflags(ios::right)<<setw(12)<<de[x];
cout<<setiosflags(ios::right)<<setw(21)<<rpmf[x]<<endl;
}
cout<<"Ulangi lagi? \n Y or N ";
cin>>jwb;
if (jwb=='Y'||jwb=='y')
{goto again;}
else
{cout<<"--------------------------";}
}
Artikel Terkait
0 komentar :
Posting Komentar