Twitter Update

The program makes a password with the string [C]

If you create a password with an integer may be familiar, but if you create a password with a string that uses the header file string.h and function strcmp or so-called string compare.
just to share for my friends. and this is the code :

#include<stdio.h>
#include <string.h>
#include<windows.h>
#include<conio.h>
void main()

{
ulang:
    char pas[10];
    printf("            ---PROGRAM DI KUNCI---");
    printf("\n\nInfo= Passwordnya adalah albert");
    printf("\n\nMasukan Password : ");
    scanf("%s",pas);
    if(strcmp(pas,"albert")==0)
    {
        system("cls");
        printf("Anda berhasil login..");
        printf("\n\nTerima kasih telah menggunakan program ini..\n\n");
        getch();
    }
    else
    {

        printf("Password yang anda masukan salah...!\n");
        printf("silahkan coba lagi..");
        getch();
        system("cls");
        goto ulang;
    }
}

simple right? in strcmp (string compare that 0 is true and 1 is false),
Hope can help ..
Thx :D





0 comments:

Post a Comment

ABOUT ME

IP
Albert Julius. Powered by Blogger.
Copyright © Albert'Blog