#include "iostream.h"
double discount(double harga);
void main(){
double hrg;
cout<<"Metode sederhana C++ dengan Fungsi\n" ;
cout<<"__________________________________\n" ;
cout<<"Total harga : " ;
cin>>hrg;
cout<<"Diskon : "<<discount(hrg);
}
double discount(double harga){
double disc;
if(harga>=2000000)disc=0.1*harga;
else if(harga>=1000000)disc=0.05*harga;
else disc=0;
return(disc);
}
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar