Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Password Program Help Please!!!

Password Program Help Please!!!

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    posidonofthecode
    wrote on last edited by
    #1

    Hello everyone. The following code works perfectly. I would like to expand it so that the program can remember more that just one character as a password/input. #include main() { char pass; system("clear"); printf("\n\nWhat is the password?\n\n"); scanf("%c",&pass); if (pass == 'l') { system("clear"); printf("\n\nVery good.\n\n");} else {system("clear"); printf("\n\nVery bad!\n\n");}

    D 1 Reply Last reply
    0
    • P posidonofthecode

      Hello everyone. The following code works perfectly. I would like to expand it so that the program can remember more that just one character as a password/input. #include main() { char pass; system("clear"); printf("\n\nWhat is the password?\n\n"); scanf("%c",&pass); if (pass == 'l') { system("clear"); printf("\n\nVery good.\n\n");} else {system("clear"); printf("\n\nVery bad!\n\n");}

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Try:

      char pass[10];
      system("clear");
      printf("\n\nWhat is the password?\n\n");
      scanf("%s", pass);
      if (strcmp(pass, "l") == 0)

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      P 1 Reply Last reply
      0
      • D David Crow

        Try:

        char pass[10];
        system("clear");
        printf("\n\nWhat is the password?\n\n");
        scanf("%s", pass);
        if (strcmp(pass, "l") == 0)

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        P Offline
        P Offline
        posidonofthecode
        wrote on last edited by
        #3

        Thanks.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups