From 3933467998d16a6c8c5c5274044bb19b33e8ec37 Mon Sep 17 00:00:00 2001 From: Muhammad Nauval Faiq Khimi <72137742+novalfaiq@users.noreply.github.com> Date: Mon, 25 Oct 2021 17:59:50 +0800 Subject: [PATCH] Create rectangle_and_triangle_calculator.cpp --- .cpp/rect_and_triangle_calculator.cpp | 116 ++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .cpp/rect_and_triangle_calculator.cpp diff --git a/.cpp/rect_and_triangle_calculator.cpp b/.cpp/rect_and_triangle_calculator.cpp new file mode 100644 index 0000000..161928b --- /dev/null +++ b/.cpp/rect_and_triangle_calculator.cpp @@ -0,0 +1,116 @@ +/* + USER & PASSWORD: + user : a1 + passowrd : a2 +*/ + + +#include +using namespace std; + +int main() { + string usr, pass; + float panjang, lebar, alas, tinggi, luas; + char confirm; + int prog; + + do { + system("cls"); + cout << "\n\n\n\n\n\n"; + cout << " ============================================" << endl; + cout << " >> user : "; + cin >> usr; + + cout << " >> pass : "; + cin >> pass; + cout << " ============================================" << endl; + + if (usr == "a1" && pass == "a2"){ + do { + system("cls"); + cout << "\n\n\n\n\n\n"; + cout << " ============================================" << endl << endl; + cout << " >> Choose the program (1 or 2) : "; + cin >> prog; + + if (prog == 1) { + cout << "\n"; + cout << " ____________________________________________" << endl << endl; + cout << " [Program Penghitung Luas Persegi Panjang]" << endl << endl; + cout << " >> Masukkan Panjang : "; + cin >> panjang; + cout << " >> Masukkan Lebar : "; + cin >> lebar; + + luas = panjang * lebar; + + cout << "\n"; + cout << " ____________________________________________" << endl << endl; + cout << " >> Luas persegi panjang adalah " << luas << endl << endl; + cout << " >> Input data lagi (Y/T) ? : "; + cin >> confirm; + system("cls"); + + } else if (prog == 2) { + cout << "\n"; + cout << " ____________________________________________" << endl << endl; + cout << " [Program Penghitung Luas Segitiga]" << endl << endl; + cout << " >> Masukkan alas : "; + cin >> alas; + cout << " >> Masukkan tinggi : "; + cin >> tinggi; + + luas = 0.5 * alas * tinggi; + + cout << "\n"; + cout << " ____________________________________________" << endl << endl; + cout << " >> Luas segitiga adalah " << luas << endl << endl; + cout << " >> Input data lagi (Y/T) ? : "; + cin >> confirm; + + } else { + cout << "\n"; + cout << " ____________________________________________" << endl << endl; + cout << " >> Program not found ... " << endl << endl; + cout << " >> Input data lagi (Y/T) ? : "; + cin >> confirm; + } + } while (confirm == 'Y' || confirm == 'y'); + + cout << "\n"; + cout << " ---------------------!!!--------------------" << endl << endl; + cout << " Please enter to close ... "; + getchar(); + + } else if (usr != "a1" && pass == "a2") { + + cout << "\n"; + cout << " >> Sorry username incorrect !!! " << endl << endl; + cout << " >> Input pass lagi (Y/T) ? : "; + cin >> confirm; + cout << "\n"; + cout << " ============================================" << endl; + + } else if (usr == "a1" && pass != "a2") { + + cout << "\n"; + cout << " >> Sorry password incorrect !!! " << endl << endl; + cout << " >> Input pass lagi (Y/T) ? : "; + cin >> confirm; + cout << "\n"; + cout << " ============================================" << endl; + + } else { + + cout << "\n"; + cout << " >> Sorry username & password incorrect !!! " << endl << endl; + cout << " >> Input pass lagi (Y/T) ? : "; + cin >> confirm; + cout << "\n"; + cout << " ============================================" << endl; + + } + } while (confirm == 'Y' || confirm == 'y'); + cin.get(); + return 0; +}