Results 1 to 4 of 4

Thread: Assalam o Alaikum

  1. #1
    qurrat4u is offline Senior Member+
    Last Online
    23rd December 2020 @ 12:10 AM
    Join Date
    02 Dec 2010
    Location
    Karachi
    Gender
    Female
    Posts
    93
    Threads
    7
    Credits
    1,271
    Thanked
    0

    Default Assalam o Alaikum

    Yeh jo aap imgs dekh rahe hain is ka "C language" & "c++" me code kaise use hoga n password insert krne ka kya code hoga with switch case.Meanz yeh program kis tarah bane ga in "C language" & "c++" me new hun is course me plzz help me jis ko bhi aata ho yeh step plzz share kren shukriya...
    Attached Images Attached Images      

  2. #2
    AsifSattarvi's Avatar
    AsifSattarvi is offline Advance Member
    Last Online
    12th October 2022 @ 02:54 PM
    Join Date
    20 May 2012
    Gender
    Male
    Posts
    6,594
    Threads
    104
    Credits
    30,058
    Thanked
    960

    Default

    اس کو چیک کریں
    A password program

    #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[i]=l;
    else goto shahab;
    if(x[i]==13)break;
    else if(x[i]==8)


    {
    gotoxy(1,2);
    clreol();
    for(i=0;i<100;i++)
    x[i]='\0';
    goto restart;
    }
    else


    {
    cout<<"*";
    k++;
    }
    }
    cout<<"\nRe enter password: \n";
    for(i=0;i<=k;i++)


    {
    x1[i]=getche();
    if(x1[i]==13)break;
    }
    for(i=0;i<=k;i++)
    if(x[i]!=x1[i])j++; if(j==0)cout<<"\nPasswords match!!\n";
    else cout<<"\nPasswords do not match!!\n";
    getch();
    }

  3. #3
    AsifSattarvi's Avatar
    AsifSattarvi is offline Advance Member
    Last Online
    12th October 2022 @ 02:54 PM
    Join Date
    20 May 2012
    Gender
    Male
    Posts
    6,594
    Threads
    104
    Credits
    30,058
    Thanked
    960

    Default

    اس کو بھی اپنی ضرورت کے حساب سے تبدیل کر لیں اگر تبدیلی محسوس کر یں تو
    #include <iostream> // library that contains basic input output functions
    #include <string> // library for c++ strings

    using namespace std;

    int main()
    {
    //Username and Password to validate credentials
    const string USERNAME = "user";
    const string PASSWORD = "123456";
    //strings in which user will enter username and password
    string username, password;

    // Prompting user to input username
    cout << "Enter Username : ";
    cin >> username;

    //Checking if username length is less than 4 characters then display an error message
    if(username.length() < 4)
    {
    cout << "Username length must be atleast 4 characters long.";
    }
    else //if username length is greater than 3
    {
    //promprting user for password
    cout << "Enter Password : ";
    cin >> password;
    //Checking if password length is less than 6 characters then display an error message
    if(password.length() < 6)
    {
    cout << "Password length must be atleast 6 characters long.";
    }
    else //if password length is greater than 5
    {
    //Checking if user's entered credentials are equal to actual USERNAME and PASSWORD
    if(username == USERNAME && password == PASSWORD)
    {
    cout << "User credentials are correct!!!" << endl;
    }
    else
    {
    cout << "Invalid login details" << endl;
    }
    }
    }

    return 0;

  4. #4
    qurrat4u is offline Senior Member+
    Last Online
    23rd December 2020 @ 12:10 AM
    Join Date
    02 Dec 2010
    Location
    Karachi
    Gender
    Female
    Posts
    93
    Threads
    7
    Credits
    1,271
    Thanked
    0

    Default

    Thank u so much 4 sharing this but humain agr isey c languge me yeh code use krna ho to isi tarah use kren ge ya difference hoga n plzz agar aap k paas "switch statement" n "break" k code hon to zaroor share ki jiye ga once again thank u....

Similar Threads

  1. Assalam o Alaikum
    By lovertariq in forum Introduction
    Replies: 16
    Last Post: 17th June 2020, 04:42 AM
  2. Assalam alaikum
    By syed_prince in forum Ask an Expert
    Replies: 1
    Last Post: 29th January 2013, 01:41 PM
  3. Assalam-o-Alaikum 2 All
    By aikpani in forum Introduction
    Replies: 12
    Last Post: 3rd February 2010, 11:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •