#include <conio.h>
#include <iostream.h>
int main()
{
char cTarif, cTarifx, cTarify;
int iVerbrauch, iNeutz, iAltz;
float fmwst=1.19,fKosta,fKostb,fKostc,fKostd,fGrunda=15,fGrundb=25,fGrundc=40,fGrundd=70,fKostx,fKosty,fPreisa=0.35,fPreisb=0.3,fPreisc=0.25,fPreisd=0.2,fKosten;
gotoxy(5,2);cout<<"Tarifuebersicht";
gotoxy(5,3);cout<<"***************";
gotoxy(5,5);cout<<"Tarif a:Grundgebuehr: 15 Euro; Preis pro kWh: 0,35/kWh";
gotoxy(5,6);cout<<"Tarif b:Grundgebuehr: 25 Euro; Preis pro kWh: 0,30/kWh";
gotoxy(5,7);cout<<"Tarif c:Grundgebuehr: 40 Euro; Preis pro kWh: 0,25/kWh";
gotoxy(5,8 );cout<<"Tarif d:Grundgebuehr: 70 Euro; Preis pro kWh: 0,20/kWh";
gotoxy(5,10);cout<<"Geben Sie den alten Zaehlerstand ein: "; cin>>iAltz;
gotoxy(5,11);cout<<"Geben Sie den neuen Zaehlerstand ein: "; cin>>iNeutz;
iVerbrauch=iNeutz-iAltz;
fKosta = (iVerbrauch * fPreisa + fGrunda) * fmwst;
fKostb = (iVerbrauch * fPreisb + fGrundb) * fmwst;
fKostc = (iVerbrauch * fPreisc + fGrundc) * fmwst;
fKostd = (iVerbrauch * fPreisd + fGrundd) * fmwst;
if(fKosta<fKostb)
{
cTarifx='a';
fKostx=fKosta;
}
else
{
cTarifx='b';
fKostx=fKostb;
}
if(fKostc<fKostd)
{
cTarify='c';
fKosty=fKostc;
}
else
{
cTarify='d';
fKosty=fKostd;
}
if(fKostx<fKosty)
{
fKosten=fKostx;
cTarif=cTarifx;
}
else
{
fKosten=fKosty;
cTarif=cTarify;
}
gotoxy(5,13);cout<<"Bei einem Verbrauch von "<<iVerbrauch<<"kWh betragen nach Tarif "<<cTarif<<" die Kosten "<<fKosten<<"Euro.";
getch();
}