Algoritma 5.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string.h> using namespace std; int main() { cout<<"============================================"<<endl; cout<<"\tProgram Struktur Percabangan"<< endl; cout<<"============================================"<<endl; int nilai, jk; char gender[20]; cout<<"Masukan Nilai Mahasiswa [0-100]\t:"; cin>>nilai; cout<<"Jika nilai diatas 55 maka mahasiswa lulus"<<endl; cout<<"Selain itu maka mahasiswa tidak lulus"<<endl; cout<<"============================================"<<endl; cout<<"Nilai yang anda masukan adalah\t: "<<nilai<<endl; //=================================================// if (nilai > 55) { cout<<"Hasilnya adalah mahasiswa lulus"<<endl; } else { cout<<"Hasilnya adalah mahasiswa tidak lulus"<<endl; } //================================================// cout<<"============================================"<< endl; cout<<"Masukan pilihan jenis kelamin."<<endl<<"[1:Pria, 2:Wanita]\t\t:"; cin>>jk; cout<<endl; if (jk == 1) { strcpy(gender,"Pria"); } else if (jk == 2) { strcpy(gender, "Wanita"); } else { strcpy(gender, "Not Supported"); } cout<<"Gender yang anda pilih adalah\t: "<<gender<<endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines