Flowcontrol C++

Contoh program flowcontrol pada C++

#include <iostream>

using namespace std;

int main()
{
string nama;
string jenisKel;

cout<<“Masukkan Nama Anda = “;
cin>>nama;
cout<<“Masukkan Jenis Kelamin Anda (L/P) = “;
cin>>jenisKel;
cout<<“Nama Anda Adalah “<<nama<<endl;
if(jenisKel == “L”)
{
cout<<“Jenis Kelamin Anda Laki-Laki”<<endl;
}
else if (jenisKel == “P”)
{
cout<<“Jenis Kelamin Anda Perempuan”<<endl;
}
else
{
cout<<“Jenis Kelamin Anda Tidak Terdeteksi”<<endl;
}

return 0;
}

Hasil runningnya

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s