Little boy questioned his mother, he asked what he can be in the future..with a sad smile, she tells him he can be anything he wants to be.... Boy said he’d become (an) astronaut and fly out into space crews around the universe he wanted to see the stars and also see other planets in outer space------------- "Why don’t we just keep dreaming, let’s keep our mind with dream and faith, as long as we wish we can make it come true, how old you are never forget your dream and keep dreaming "

Saturday 17 May 2014

Algoritma Validasi Username dan Password | Gan~San

Mungkin teman teman yang sedang belajar C++ penasaran dengan Algoritma bagaimana suatu algoritma mem- validasi sebuah Username & Password..



Berikut contoh algoritma yang di masukan ke dalam Bahasa C/C++ :

#include<iostream>
#include <conio.h>
using namespace std;

int main()
{
int sah;
int k;
int user,pswd,iuser,ipswd;
user=12345;
pswd=12345;
sah=0;
cout << "----------------------------------------------------------"<<endl;
cout << "|              SELAMAT DATANG DI PROGRAM LOGIN           |"<<endl;
cout << "----------------------------------------------------------"<<endl;
while ((sah==0)&&(k <= 3)){
cout << "\nInputkan Username : "; cin >> iuser;
cout << "\nInputkan Password : "; cin >> ipswd;
if ((iuser == user)&&(ipswd == pswd)){
sah=1;
cout << "\nAnda berhasil masuk\n";
}
else {
if ((iuser != user)||(ipswd != pswd)){
cout << "\nMaaf Password atau Username yang anda inputkan salah\n";
k=k+1;
}}
}
getch(); }

Sekian Terma Kasih :-) Semoga Bermanfaat

No comments:

Post a Comment