#include<iostream.h>
int n1,n2,n3,max;
void main()
{
cout<<" Masukkan Nilai 1 : "; cin>>n1;
cout<<" Masukkan Nilai 2 : "; cin>>n2;
cout<<" Masukkan Nilai 3 : "; cin>>n3;
if (n1 > n2)
{
if (n1 > n3)
{
max = n1;
}
else max = n3;
}
else if (n2 > n3)
{
max = n2;
}
else max = n3;
cout<<" Nilai Terbesar Adalah : "<<max;
return;
}
mencari harga motor
#include<iostream.h>
#include<string.h>
main()
{
char Kode[3], Nama[30], N_motor[30], Bonus[30];
long jumlah, Tot, Harga;
cout<<" Masukkan Nama : "; cin>>Nama;
cout<<" Masukkan Jumlah : "; cin>>jumlah;
cout<<" Masukkan Kode : "; cin>>Kode;
if (strcmp(Kode,"HT"))
{
strcpy(N_motor,"Honda Tiger");
Harga = 13000000;
strcpy(Bonus," Velg Racing"); }
else if(strcmp(Kode,"HS"))
{
strcpy(N_motor,"Honda Supra");
Harga = 12000000;
strcpy(Bonus," Jaket"); }
else if
(strcmp(Kode,"YM"))
{
strcpy(N_motor,"Yamaha Mio");
Harga = 11000000;
strcpy(Bonus," Helm"); }
else if
(strcmp(Kode,"YV"))
{
strcpy(N_motor,"Yamaha Vega");
Harga = 10000000;
strcpy(Bonus," Knalpot Racing"); }
else
cout << "Kode Tidak Dikenal";
Tot = jumlah * Harga;
cout<<endl;
cout<<" Nama Motor : "<<N_motor<<endl;
cout<<" Harga : "<<Harga<<endl;
cout<<" Bonus : "<<Bonus<<endl;
cout<<" Total Harga : "<<Tot<<endl;
return(0);
}
#include<iostream.h>
int n1,n2,n3,max;
void main()
{
cout<<" Masukkan Nilai 1 : "; cin>>n1;
cout<<" Masukkan Nilai 2 : "; cin>>n2;
cout<<" Masukkan Nilai 3 : "; cin>>n3;
if (n1 > n2)
{
if (n1 > n3)
{
max = n1;
}
else max = n3;
}
else if (n2 > n3)
{
max = n2;
}
else max = n3;
cout<<" Nilai Terbesar Adalah : "<<max;
return;
}
mencari harga motor
#include<iostream.h>
#include<string.h>
main()
{
char Kode[3], Nama[30], N_motor[30], Bonus[30];
long jumlah, Tot, Harga;
cout<<" Masukkan Nama : "; cin>>Nama;
cout<<" Masukkan Jumlah : "; cin>>jumlah;
cout<<" Masukkan Kode : "; cin>>Kode;
if (strcmp(Kode,"HT"))
{
strcpy(N_motor,"Honda Tiger");
Harga = 13000000;
strcpy(Bonus," Velg Racing"); }
else if(strcmp(Kode,"HS"))
{
strcpy(N_motor,"Honda Supra");
Harga = 12000000;
strcpy(Bonus," Jaket"); }
else if
(strcmp(Kode,"YM"))
{
strcpy(N_motor,"Yamaha Mio");
Harga = 11000000;
strcpy(Bonus," Helm"); }
else if
(strcmp(Kode,"YV"))
{
strcpy(N_motor,"Yamaha Vega");
Harga = 10000000;
strcpy(Bonus," Knalpot Racing"); }
else
cout << "Kode Tidak Dikenal";
Tot = jumlah * Harga;
cout<<endl;
cout<<" Nama Motor : "<<N_motor<<endl;
cout<<" Harga : "<<Harga<<endl;
cout<<" Bonus : "<<Bonus<<endl;
cout<<" Total Harga : "<<Tot<<endl;
return(0);
}
Tidak ada komentar:
Posting Komentar