Saturday 26 October 2013
TUTORIAL C++ PENGGUNAAN IF DAN ELSE UNTUK MEMILIH BARANG
#include <iostream>
using namespace std;
int main()
{
int choice;
cout<<"es krim yang diminta"<<endl;
cout<<"masukkan 1 untuk coklat"<<endl;
cout<<"masukkan 2 untuk vanila"<<endl;
cout<<"masukkan 3 untuk strawberry"<<endl;
cout<<"masukkan 4 untuk mocca"<<endl;
cout<<"masukkan pilihan:";
cin>>choice;
if(choice==1)
{
cout<<"coklat pilihan yang bagus"<<endl;
}
else
if(choice==2)
{
cout<<"vanila enak sekali"<<endl;
}
else if(choice==3)
{
cout<<"strawberry sangat segar"<<endl;
}
else if(choice==4)
{
cout <<"mocca lezat dan harum"<<endl;
}
else {
cout<<"kita tidak punya pilihan tersebut "<<endl;
cout<<"pilih rasa yang lainnya"<<endl;
}
}
Labels:
C++,
ILMU,
TEKNIK INFORMATIKA,
TUTORIAL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment