Output jika inputan ID dan PASSWORD benar ! |
Output jika ID& PASSWORD salah sebanyak 3x berturut turut |
inilah kode program nya...
#include <iostream.h>
#include <conio.h>
main (void) {
int username, password;
int i;
cout << "------------------------------------------\n";
cout << "Selamat Datang Di Form Login Bosen Gaptek \n";
cout << "------------------------------------------\n\n";
int user = 12345;
int pass = 12345;
i = 1;
do {
cout << "Username : "; cin >> username;
cout << "Password : "; cin >> password;
if (username = user && password == pass) {
cout << "\n--------------------\n";
cout << "Anda Berhasil Login" << endl;
cout << "--------------------\n\n";
} else {
cout << "\n------------------------\n";
cout << "Maaf ID & PASSWORD Salah!" << endl;
cout << "-------------------------\n\n";
i = i +1;
}
}
while (i <= 3);
cout << "Anda Telah 3x Memasukan ID & PASSWORD Yang Salah\n";
cout << "Mohon Maaf Akun Anda Kami Blockir, Terima Kasih..";
getch();
}
#include
BalasHapus#include
#include
main ()
{
char user[50], pass[20];
int i;
printf( "------------------------------------------\n");
printf( "Selamat Datang Di Form Login Bosen Gaptek \n");
printf( "------------------------------------------\n\n");
i = 1;
do {
printf( "Username : ");gets(user);
fflush(stdin);
printf( "Password : ");gets(pass);
if ((strcmp(user,"cantik")==0) && (strcmp(pass,"bdg120496")==0))
{
printf ( "\n--------------------\n");
printf ( "Anda Berhasil Login \n" );
printf ( "--------------------\n\n");
printf ( " Selamat datang %s ditempat bahagia \n",user);
break;
}
else {
printf( "\n------------------------\n");
printf( "Maaf ID & PASSWORD Salah!" );
printf( "-------------------------\n\n");
i = i +1;
}
}
while (i <= 3) ;
printf( "Anda Telah 3x Memasukan ID & PASSWORD Yang Salah\n");
printf( "Mohon Maaf Akun Anda Kami Blockir, Terima Kasih..");
getch();
}
ini nih kalo mau selain angka hahaha, tolong dicoba trus yg akhirnya masih suka ngikut, gimana cara ngilanginya
BalasHapusbagus ni tapi
BalasHapusgmana cara membuat program yang ketika loginnya salah dia akan mengulang.
namun ketikan loginnya benar di tidak mengulang,
ka maryam ko programnya gak bisa di running ya ? ada yang salah kayanya itu,,
BalasHapusstdio.h nya mana ?
BalasHapusGan,, kalo misalkan 12345 diganti dengan huruf bisa gak???? misalkan diganti dengan nama kita bgitu.../ghiovoelker@gmail.com
BalasHapuspake string user = "Nama Agan";
Hapusstring pass = "Password Agan";
pengin buat game di c++ tapi gk tau caranya jdinya kyk gini nih wwkwkwkwkwkwk
BalasHapus#include
#include
#include
// created by Farhan Mufti Hilmy
using namespace std;
int main()
{
string name;
int age;
int yesno;
int hasil;
int hasil2;
cout << " "<< "----------------" << endl;
cout << " "<< " Game Ragenah " << endl;
cout << " "<< "----------------" << endl << endl;
cout << "press any key to get started!" << endl;
getch();
cout << endl;
cout << "Welcome to Game Ragenah. What's your Nickname?" << endl << endl;
cin >> name;
cout << endl;
cout << "Hello " << name << "! Anyway how old are you?" << endl << endl;
cin >> age;
cout << endl;
if(age<=10){
cout << "you're too younger. Can you solve my problem? [1 to say yes/2 to say no]" << endl<< endl;
cin >> yesno;
cout << endl;
} else if(age>=50){
cout << "you're too old. Can you solve my problem? [1 to say yes/2 to say no]" << endl << endl;
cin >> yesno;
cout << endl;
} else if((age>10) && (age<50)){
cout << "Got it. Can you solve my problem? [1 to say yes/2 to say no]" << endl << endl;
cin >> yesno;
cout << endl;
}
if(yesno==1){
cout << "That'll be great. Ok, Solve this problem 2345 * 2!" << endl << endl;
cin >> hasil;
cout << endl;
} else if(yesno==2){
cout << "You must be joking, right?. Ok, Solve this problem 2345 * 2!" << endl << endl;
cin >> hasil;
cout << endl;
}
if(hasil==4690){
cout << "Well done!. You're good at math, How about 98272638 * 3?" << endl << endl; // 294817914
cin >> hasil2;
cout << endl;
if(hasil2==294817914){
cout << "Oh surely, you used a calculator, isn't it?. But no problem, it's okay" << endl << endl;
getch();
cout << "Thanks for solved my problem, I'll give you a surprise" << endl << endl;
getch();
for(int i=1;i<=10;i++){
for(int j=1;j<=10;j++){
cout << j << " x " << i << " = " << j*i << " " << endl;
}
cout << endl;
}
cout << endl << endl;
cout << "That's it. Hope you like it";
getch();
} else {
cout << "Sorry you lose" << endl;
cout << "_____ _____" << endl;
cout << " |__| |_| " << endl;
cout << " ___ " << endl;
cout << " \ / " << endl;
cout << "__ __" << endl;
cout << " --__ __-- " << endl;
cout << " --___-- " << endl;
getch();
}
} else{
cout << "Sorry, you lose" << endl;
cout << "_____ _____" << endl;
cout << " |__| |_| " << endl;
cout << " ___ " << endl;
cout << " \ / " << endl;
cout << "__ __" << endl;
cout << " --__ __-- " << endl;
cout << " --___-- " << endl;
getch();
}
getch();
}
Kak kalo dibikinnya pakek array,bisa gak? Mohon bantuannya kak buat projek kuliah🙏
BalasHapus