Last active
September 19, 2023 09:41
-
-
Save Khuirul-Huda/32937b225e642e587cf5076415de278c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int umur; | |
string jenisKelamin; | |
float hasilTes1; | |
float hasilTes2; | |
float kolomC; | |
float kolomE; | |
float kolomF; | |
string kriteriaKebugaran; | |
cout << "Masukkan Umur Anda: "; | |
cin >> umur; | |
cout << "Masukkan Jenis Kelamin Anda: "; | |
cin.ignore(); | |
getline(cin, jenisKelamin); | |
cout << "Hasil Tes 1: "; | |
cin >> hasilTes1; | |
cout << "Hasil Tes 2: "; | |
cin >> hasilTes2; | |
if (umur >= 20 && umur <= 30) { | |
if (jenisKelamin[0] == 'L' || jenisKelamin[0] == 'l') { | |
if (hasilTes1 >= 38 && hasilTes1 <= 40) { | |
kolomC = 3; | |
} else if (hasilTes1 > 35 && hasilTes1 <= 37) { | |
kolomC = 2; | |
} else if ( hasilTes1 <= 35 ) { | |
kolomC = 1; | |
} | |
if (hasilTes2 >= 14 && hasilTes2 <= 16) { | |
kolomE = 3; | |
} else if ( hasilTes2 > 11 && hasilTes2 <= 13) { | |
kolomE = 2; | |
} else if ( hasilTes2 <= 11) { | |
kolomE = 1; | |
} | |
} else if (jenisKelamin[0] == 'P' || jenisKelamin[0] == 'p') { | |
if (hasilTes1 >= 34 && hasilTes1 <= 36) { | |
kolomC = 3; | |
} else if (hasilTes1 >= 32 && hasilTes1 <= 34) { //? | |
kolomC = 2; | |
} else if ( hasilTes1 <= 31 ) { | |
kolomC = 1; | |
} | |
if (hasilTes2 > 10 && hasilTes2 <= 13) { | |
kolomE = 3; | |
} else if ( hasilTes2 >= 8 && hasilTes2 <= 10) { | |
kolomE = 2; | |
} else if ( hasilTes2 < 8) { | |
kolomE = 1; | |
} | |
} | |
} else if (umur >= 31 && umur <= 40) { | |
if (jenisKelamin[0] == 'L' || jenisKelamin[0] == 'l') { | |
if (hasilTes1 > 35 && hasilTes1 <= 37) { | |
kolomC = 3; | |
} else if (hasilTes1 > 32 && hasilTes1 <= 35) { | |
kolomC = 2; | |
} else if ( hasilTes1 >= 30 && hasilTes1 <= 32 ) { | |
kolomC = 1; | |
} | |
if (hasilTes2 >= 28 && hasilTes2 <= 30) { | |
kolomE = 3; | |
} else if ( hasilTes2 > 25 && hasilTes2 <= 27) { | |
kolomE = 2; | |
} else if ( hasilTes2 < 25) { | |
kolomE = 1; | |
} | |
} else if (jenisKelamin[0] == 'P' || jenisKelamin[0] == 'p') { | |
if (hasilTes1 > 30 && hasilTes1 <= 32) { | |
kolomC = 3; | |
} else if (hasilTes1 >= 28 && hasilTes1 <= 30) { //? | |
kolomC = 2; | |
} else if ( hasilTes1 < 28 ) { | |
kolomC = 1; | |
} | |
if (hasilTes2 > 22 && hasilTes2 <= 24) { | |
kolomE = 3; | |
} else if ( hasilTes2 >= 20 && hasilTes2 <= 22) { | |
kolomE = 2; | |
} else if ( hasilTes2 < 20) { | |
kolomE = 1; | |
} | |
} | |
} | |
kolomF = (kolomC + kolomE) / 2; | |
if (kolomF >= 2.5) { | |
kriteriaKebugaran = "Sangat Bugar"; | |
} else if (kolomF >= 2 ) { | |
kriteriaKebugaran = "Cukup Bugar"; | |
} else if (kolomF >= 1) { | |
kriteriaKebugaran = "Kurang Bugar"; | |
} | |
cout << "Umur Anda Adalah: " << umur << endl; | |
cout << "Jenis Kelamin Anda Adalah: " << jenisKelamin << endl; | |
cout << "Tingkat Kebugaran Anda adalah: " << kolomF << " (Skor) " << "Keterangan: " << kriteriaKebugaran << " (keterangan)" << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment