#include <iostream.h>
#include <string.h>
#include <stdlib.h>
struct konsumen
{
char nama [50];
int h;
int m;
int s;
}
;
void main()
{
konsumen user ;
char buffer[10];
float durasi;
float biaya;
cout << "input name : ";
cin.getline (user.nama,50);
cout << "input hour : ";
cin.getline (buffer,6);
user.h = atof (buffer);
cout << "input minute : ";
cin.getline (buffer,6);
user.m = atof (buffer);
cout << "input second : ";
cin.getline (buffer,6);
user.s = atof (buffer);
cout<<endl;
cout<<"Nama
Konsumen : " << user.nama <<endl;
cout<<user.nama<<"
telah menggunakan warnet selama "<<user.h<<" jam
"<<user.m<<" menit "<<user.s<<"
detik"<<endl;
durasi = ((user.h * 3600 )+
(user.m * 60 )+ (user.s));
biaya = ((durasi / 30) *
130);
cout<<user.nama
<<" harus membayar sebesar Rp. "<< biaya;
}
No comments:
Post a Comment