اريد كود باسوورد في بورلند ++c
في جملة for loop
اذا ادخلها ثلاث مرات ولم تكن صحيحة يخرج من البرنامج
ارجو الا تخيبوني
اخوكم جديد
اريد كود باسوورد في بورلند ++c
في جملة for loop
اذا ادخلها ثلاث مرات ولم تكن صحيحة يخرج من البرنامج
ارجو الا تخيبوني
اخوكم جديد
بسم الله الرحمن الرحيم
السلام عليكم ورحمة الله وبركاتة
دة كود password سهل وصغير وسهل التعديل فية .....
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"Enter password: \n";
restart:int x[100],x1[100],i,j=0,k=0,l;
for(i=0;i<=100;i++)
{
shahab:l=getch();
if(((l>=48)&&(l<=126))||(l==8)||(l==13))x=l;
else goto shahab;
if(x==13)break;
else if(x==8)
{
gotoxy(1,2);
clreol();
for(i=0;i<100;i++)
x='\0';
goto restart;
}
else
{
cout<<"*";
k++;
}
}
cout<<"\nRe enter password: \n";
for(i=0;i<=k;i++)
{
x1=getche();
if(x1==13)break;
}
for(i=0;i<=k;i++)
if(x!=x1)j++; if(j==0)cout<<"\nPasswords match!!\n";
else cout<<"\nPasswords do not match!!\n";
getch();
}
بعد إذن صاحب الرد بأعيد وضع الكود لكن بشكل أفضل للقراءة
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"Enter password: \n";
restart:int x[100],x1[100],i,j=0,k=0,l;
for(i=0;i<=100;i++)
{
shahab:l=getch();
if(((l>=48)&&(l<=126))||(l==8)||(l==13))x=l;
else goto shahab;
if(x==13)break;
else if(x==8)
{
gotoxy(1,2);
clreol();
for(i=0;i<100;i++)
x='\0';
goto restart;
}
else
{
cout<<"*";
k++;
}
}
cout<<"\nRe enter password: \n";
for(i=0;i<=k;i++)
{
x1=getche();
if(x1==13)break;
}
for(i=0;i<=k;i++)
if(x!=x1)j++; if(j==0)cout<<"\nPasswords match!!\n";
else cout<<"\nPasswords do not match!!\n";
getch();
}وهذا كودي B)
#include<iostream>
#include<cstdlib>
#include<cstdio>
using namespace std;
int main()
{
int mypassword = 123456; // تقدر تحط أي رقم من عندك
int num_pass = 0 ; // عدد مرات إدخال الرقم السري
int pass_user;// الرقم السري اللي بيدخله المستخدم
for(int i=0; i<3;i++)
{
cout<<"Please Enter Your PassWord \n";
cin>>pass_user;
if(pass_user == mypassword )
{
cout<<"Your PassWord Correct \n";
break;
}
else {
mypassword++;
cout<<"Your PassWord Not Correct \n";
}
if(mypassword == 3 )
exit(0);
}
return 0;
}يارب يعجبك هذا الكود :)
هذا الموضوع مغلق.