Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create rect_and_triangle_calculator.cpp #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .cpp/rect_and_triangle_calculator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
USER & PASSWORD:
user : a1
passowrd : a2
*/


#include <iostream>
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;
}