Rabu, 30 Desember 2015
menghitung luas 2 kerucut c++ "program modify 3(b)"
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class kerucut{
int la;
int ls;
public:
void luas_kerucut(int,int);
luas(){return(la+ls);
}
};
void kerucut::luas_kerucut(int x,int y){
la=x;
ls=y;
}
int main(int argc, char** argv) {
kerucut a,b;
int x,y;
cout<<"Luas alas: ";cin>>x;
cout<<"Luas selimut:";cin>>y;
a.luas_kerucut(x,y);
b.luas_kerucut(11,5);
cout<<"Luas Kerucut A: "<<a.luas()<<endl;
cout<<"Luas Kerucut B: "<<b.luas();
return 0;
}
Menghitung luas persegi dengan c++ "tugas program modify 3(a) "
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class persegi{
public:
int s;
int luas(){return(s*s);
}
};
int main(int argc, char** argv) {
persegi x;
cout<<"masukan sisi: ";cin>>x.s;
cout<<"luas persegi: "<<x.luas();
return 0;
}
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class persegi{
public:
int s;
int luas(){return(s*s);
}
};
int main(int argc, char** argv) {
persegi x;
cout<<"masukan sisi: ";cin>>x.s;
cout<<"luas persegi: "<<x.luas();
return 0;
}
Menghtiung volume balok C++ "program modify dua"
#include <iostream>
using namespace std;
class balok{
int p,l,t;
public:
void balook(int,int,int);
int hasil(void){
return(p*l*t)
;}
};
void balok::balook(int a,int b,int c){
p=a;
l=b;
t=c;
}
int main(){
balok blok, blk;
int s,n,l;
cout<<"Panjang: ";cin>>s;
cout<<"Lebar: ";cin>>n;
cout<<"Tinggi: ";cin>>l;
blok.balook(s,n,l);
blk.balook(4,3,2);
cout<<blok.hasil()<<endl;
cout<<blk.hasil();
}
using namespace std;
class balok{
int p,l,t;
public:
void balook(int,int,int);
int hasil(void){
return(p*l*t)
;}
};
void balok::balook(int a,int b,int c){
p=a;
l=b;
t=c;
}
int main(){
balok blok, blk;
int s,n,l;
cout<<"Panjang: ";cin>>s;
cout<<"Lebar: ";cin>>n;
cout<<"Tinggi: ";cin>>l;
blok.balook(s,n,l);
blk.balook(4,3,2);
cout<<blok.hasil()<<endl;
cout<<blk.hasil();
}
Menghitung luas jajar genjang C++ "program modify satu"
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class jajargenjang{
int a,t;
public:
void jajar(int a,int t);
int area(void){return(a*t);}
};
void jajargenjang::jajar(int x,int y){
a=x;
t=y;
}
int main(int argc, char** argv) {
jajargenjang rect;
int x,y;
cout<<"Masukkan alas : ";cin>>x;
cout<<"Masukkan tinggi : ";cin>>y;
rect.jajar(x,y);
cout<<"luas:"<<rect.area();
return 0;
}
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class jajargenjang{
int a,t;
public:
void jajar(int a,int t);
int area(void){return(a*t);}
};
void jajargenjang::jajar(int x,int y){
a=x;
t=y;
}
int main(int argc, char** argv) {
jajargenjang rect;
int x,y;
cout<<"Masukkan alas : ";cin>>x;
cout<<"Masukkan tinggi : ";cin>>y;
rect.jajar(x,y);
cout<<"luas:"<<rect.area();
return 0;
}
TUGAS FINAL PROJEC MEMBUAT APLIKASI KASIR
#include <iostream>
#include <conio.h>
#include <cstdlib>
using namespace std;
int main()
{system ("color a");
float harga, biaya, jumlah, jawab;
int jum_bayar, bayar, kembalian;
int paket;
cout<<" ----------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| E-ANGKRINGAN[dot]COM |"<<endl;
cout<<"| Mengatasi masalah ke laparan saat hujan, Kami siap ANTAR !! |"<<endl;
cout<<"| |"<<endl;
cout<<" ----------------------------------------------------------------"<<endl<<endl;
cout<<"MENU PAKET: "<<endl;
cout<<"1. Nasi Super + Teh "<<endl;
cout<<"2. Nasi Goreng + Teh "<<endl;
cout<<"3. Sego Kucing + Teh "<<endl<<endl;
cout<<"Tipe Paket [ 1/2/3 ] = "; cin>>paket;
switch(paket)
{
case 1:
case 'a' :
harga=28000;
cout<<"Jumlah yang ingin di pesan = "; cin>>jumlah;
cout<<endl<<endl;
biaya=harga*jumlah;
cout<<" ----------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| E-ANGKRINGAN[dot]COM |"<<endl;
cout<<"| Mengatasi masalah ke laparan saat hujan, Kami siap ANTAR !! |"<<endl;
cout<<"| |"<<endl;
cout<<" ----------------------------------------------------------------"<<endl<<endl;
cout<<"RINCIAN PEMBAYARAN: "<<endl;
cout<<"Menu Paket = "<<paket<<endl;
cout<<"Jumlah = "<<jumlah<<endl;
cout<<" ------------ x"<<endl;
cout<<"Grand Total = "<<biaya<<endl;
cout<<"Bayar = "; cin>>bayar; kembalian=bayar-biaya;
cout<<" --------------"<<endl;
cout<<"Uang Kembalian = "<<kembalian<<endl<<endl;
cout<<"Terimakasih Sudah memesan di e-angkringan"<<endl;
break;
case 2:
case 'b' :
harga=15000;
cout<<"Jumlah yang ingin di pesan = "; cin>>jumlah;
cout<<endl<<endl;
biaya=harga*jumlah;
cout<<" ----------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| E-ANGKRINGAN[dot]COM |"<<endl;
cout<<"| Mengatasi masalah ke laparan saat hujan, Kami siap ANTAR !! |"<<endl;
cout<<"| |"<<endl;
cout<<" ----------------------------------------------------------------"<<endl<<endl;
cout<<"RINCIAN PEMBAYARAN: "<<endl;
cout<<"Menu Paket = "<<paket<<endl;
cout<<"Jumlah = "<<jumlah<<endl;
cout<<" ------------ x"<<endl;
cout<<"Grand Total = "<<biaya<<endl;
cout<<"Bayar = "; cin>>bayar; kembalian=bayar-biaya;
cout<<" --------------"<<endl;
cout<<"Uang Kembalian = "<<kembalian<<endl<<endl;
cout<<"Terimakasih Sudah memesan di e-angkringan"<<endl;
break;
case 3:
case 'c' :
harga=10000;
cout<<"Jumlah yang ingin di pesan = "; cin>>jumlah;
cout<<endl<<endl;
biaya=harga*jumlah;
cout<<" ----------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| E-ANGKRINGAN[dot]COM |"<<endl;
cout<<"| Mengatasi masalah ke laparan saat hujan, Kami siap ANTAR !! |"<<endl;
cout<<"| |"<<endl;
cout<<" ----------------------------------------------------------------"<<endl<<endl;
cout<<"RINCIAN PEMBAYARAN: "<<endl;
cout<<"Menu Paket = "<<paket<<endl;
cout<<"Jumlah = "<<jumlah<<endl;
cout<<" ------------ x"<<endl;
cout<<"Grand Total = "<<biaya<<endl;
cout<<"Bayar = "; cin>>bayar; kembalian=bayar-biaya;
cout<<" --------------"<<endl;
cout<<"Uang Kembalian = "<<kembalian<<endl<<endl;
cout<<"Terimakasih Sudah memesan di e-angkringan"<<endl;
break;
default:
cout<<"Maaf !! Pilihan Anda Salah! Silahkan Pilih Menu yang tersedia !"<<endl;
break;
}
char LG;
cout<<"\n \n\n Apakah anda ingin kembali memesan? [ Y/T ] ?";cin>>LG;
if (LG=='Y' || LG=='y')main();
else if (LG=='T' || LG=='t') goto x;
x:
cout<<"\t \t Terima Kasih Sudah Mencoba\n";
cout<<"\t Kami Thedi, Ridho, Firman, Agus Mengucapkan"<<endl;
cout<<"\t \t \t Terima Kasih";
}
KASIR
#include <conio.h>
#include <cstdlib>
using namespace std;
int main()
{system ("color a");
float harga, biaya, jumlah, jawab;
int jum_bayar, bayar, kembalian;
int paket;
cout<<" ----------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| E-ANGKRINGAN[dot]COM |"<<endl;
cout<<"| Mengatasi masalah ke laparan saat hujan, Kami siap ANTAR !! |"<<endl;
cout<<"| |"<<endl;
cout<<" ----------------------------------------------------------------"<<endl<<endl;
cout<<"MENU PAKET: "<<endl;
cout<<"1. Nasi Super + Teh "<<endl;
cout<<"2. Nasi Goreng + Teh "<<endl;
cout<<"3. Sego Kucing + Teh "<<endl<<endl;
cout<<"Tipe Paket [ 1/2/3 ] = "; cin>>paket;
switch(paket)
{
case 1:
case 'a' :
harga=28000;
cout<<"Jumlah yang ingin di pesan = "; cin>>jumlah;
cout<<endl<<endl;
biaya=harga*jumlah;
cout<<" ----------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| E-ANGKRINGAN[dot]COM |"<<endl;
cout<<"| Mengatasi masalah ke laparan saat hujan, Kami siap ANTAR !! |"<<endl;
cout<<"| |"<<endl;
cout<<" ----------------------------------------------------------------"<<endl<<endl;
cout<<"RINCIAN PEMBAYARAN: "<<endl;
cout<<"Menu Paket = "<<paket<<endl;
cout<<"Jumlah = "<<jumlah<<endl;
cout<<" ------------ x"<<endl;
cout<<"Grand Total = "<<biaya<<endl;
cout<<"Bayar = "; cin>>bayar; kembalian=bayar-biaya;
cout<<" --------------"<<endl;
cout<<"Uang Kembalian = "<<kembalian<<endl<<endl;
cout<<"Terimakasih Sudah memesan di e-angkringan"<<endl;
break;
case 2:
case 'b' :
harga=15000;
cout<<"Jumlah yang ingin di pesan = "; cin>>jumlah;
cout<<endl<<endl;
biaya=harga*jumlah;
cout<<" ----------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| E-ANGKRINGAN[dot]COM |"<<endl;
cout<<"| Mengatasi masalah ke laparan saat hujan, Kami siap ANTAR !! |"<<endl;
cout<<"| |"<<endl;
cout<<" ----------------------------------------------------------------"<<endl<<endl;
cout<<"RINCIAN PEMBAYARAN: "<<endl;
cout<<"Menu Paket = "<<paket<<endl;
cout<<"Jumlah = "<<jumlah<<endl;
cout<<" ------------ x"<<endl;
cout<<"Grand Total = "<<biaya<<endl;
cout<<"Bayar = "; cin>>bayar; kembalian=bayar-biaya;
cout<<" --------------"<<endl;
cout<<"Uang Kembalian = "<<kembalian<<endl<<endl;
cout<<"Terimakasih Sudah memesan di e-angkringan"<<endl;
break;
case 3:
case 'c' :
harga=10000;
cout<<"Jumlah yang ingin di pesan = "; cin>>jumlah;
cout<<endl<<endl;
biaya=harga*jumlah;
cout<<" ----------------------------------------------------------------"<<endl;
cout<<"| |"<<endl;
cout<<"| E-ANGKRINGAN[dot]COM |"<<endl;
cout<<"| Mengatasi masalah ke laparan saat hujan, Kami siap ANTAR !! |"<<endl;
cout<<"| |"<<endl;
cout<<" ----------------------------------------------------------------"<<endl<<endl;
cout<<"RINCIAN PEMBAYARAN: "<<endl;
cout<<"Menu Paket = "<<paket<<endl;
cout<<"Jumlah = "<<jumlah<<endl;
cout<<" ------------ x"<<endl;
cout<<"Grand Total = "<<biaya<<endl;
cout<<"Bayar = "; cin>>bayar; kembalian=bayar-biaya;
cout<<" --------------"<<endl;
cout<<"Uang Kembalian = "<<kembalian<<endl<<endl;
cout<<"Terimakasih Sudah memesan di e-angkringan"<<endl;
break;
default:
cout<<"Maaf !! Pilihan Anda Salah! Silahkan Pilih Menu yang tersedia !"<<endl;
break;
}
char LG;
cout<<"\n \n\n Apakah anda ingin kembali memesan? [ Y/T ] ?";cin>>LG;
if (LG=='Y' || LG=='y')main();
else if (LG=='T' || LG=='t') goto x;
x:
cout<<"\t \t Terima Kasih Sudah Mencoba\n";
cout<<"\t Kami Thedi, Ridho, Firman, Agus Mengucapkan"<<endl;
cout<<"\t \t \t Terima Kasih";
}
KASIR
Rabu, 14 Oktober 2015
program konversi suhu
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
int cel,fah,rea,kel;
start:
cout<<"================================"<<endl;
cout<<"|konversi suhu dari celcius ke |"<<endl;
cout<<"|fahrenheit:reamur:kelvin |"<<endl;
cout<<"================================"<<"\n"<<endl;
cout<<"masukan suhu dalam celcius : "; cin>>cel;
cout<<"\n";
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"hasil konversi suhu "<<endl;
cout<<"farenheit : "<<(((9.0/5.0)*cel)+32)<<endl;
cout<<"reamur : "<<((4.0/5)*cel)<<endl;
cout<<"kelvin : "<<(cel+273)<<"\n"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
return 0;
}KONVEERSI SUHU
using namespace std;
int main(int argc, char** argv) {
int cel,fah,rea,kel;
start:
cout<<"================================"<<endl;
cout<<"|konversi suhu dari celcius ke |"<<endl;
cout<<"|fahrenheit:reamur:kelvin |"<<endl;
cout<<"================================"<<"\n"<<endl;
cout<<"masukan suhu dalam celcius : "; cin>>cel;
cout<<"\n";
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"hasil konversi suhu "<<endl;
cout<<"farenheit : "<<(((9.0/5.0)*cel)+32)<<endl;
cout<<"reamur : "<<((4.0/5)*cel)<<endl;
cout<<"kelvin : "<<(cel+273)<<"\n"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
return 0;
}KONVEERSI SUHU
Minggu, 11 Oktober 2015
cara membuat program konversi suhu
Berikut merupakan Pemrograman Bahasa C++ bagaimana tentang menghitung konversi suhu dari Celcius ke fahrenheit,reamur, dan kelvin..
langsung saja di coba...
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
int cel, fah, rea, kel;
start:
cout << "=============================" << endl;
cout << "KONVERSI SUHU DARI CELCIUS KE" << endl;
cout << " Fahrenheit: Reamur: Kelvin" << endl;
cout << "=============================" << endl;
cout<< "Masukkan suhu dalam Celcius : ";
cin>>cel;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " fahrenheit : " << (((9.0/5.0)*cel) + 32)<<endl;
cout << " reamur : " << ((4.0/5.0)*cel)<<endl;
cout << " kelvin : " << (cel + 273)<<endl;
getch();
clrscr();
goto start;
}
langsung saja di coba...
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
int cel, fah, rea, kel;
start:
cout << "=============================" << endl;
cout << "KONVERSI SUHU DARI CELCIUS KE" << endl;
cout << " Fahrenheit: Reamur: Kelvin" << endl;
cout << "=============================" << endl;
cout<< "Masukkan suhu dalam Celcius : ";
cin>>cel;
cout << "=============================" << endl;
cout << "HASIL KONVERSI SUHU" << endl;
cout << "=============================" << endl;
cout << " fahrenheit : " << (((9.0/5.0)*cel) + 32)<<endl;
cout << " reamur : " << ((4.0/5.0)*cel)<<endl;
cout << " kelvin : " << (cel + 273)<<endl;
getch();
clrscr();
goto start;
}
Langganan:
Postingan (Atom)