Thread: Simple login and registration system

  1. #1
    Registered User
    Join Date
    Dec 2018
    Posts
    6

    Simple login and registration system

    I need to register and that after registering go back to the main (menu) and that the login go get the values ​​to main to validate the user and pass.


    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <locale.h>
    #include <string.h>
    
    
    void login(int utilizador);
    void registo();
    
    
    int main()
    {
        setlocale(LC_ALL,"");
        char op, utilizador[30];
        do {
            printf("|'''''''''''''''|\n");
            printf("| Jogo da Forca |\n");
            printf("|...............|\n\n");
    
    
            printf("E - Entrar\n");
            printf("R - Registar\n");
            printf("S - Sair\n\n");
            fflush(stdin);
            printf("Escolha uma opção: ");
            scanf(" %c", &op);
            op = toupper(op);
            if (op == 'E')
                {
                system("CLS");
                login(utilizador);
                }
            if (op == 'R')
                {
                system("CLS");
                registo();
                }
            }
        while (op == "S");
        system("EXIT");
    }
    
    
    void login(int utilizador){
        int id;
        char utiliza[30], pass[30];
    
    
        printf("|'''''''''''''''|\n");
        printf("| Jogo da Forca |\n");
        printf("|...............|\n\n");
    
    
        printf("LOGIN\n\n");
        printf("Introduza o seu ID: ");
        scanf(" %d", &id);
        printf("Introduza o Utilizador: ");
        scanf(" %s", &utiliza);
        printf("Introduza a Password: ");
        scanf(" %s", &pass);
        jogo();
        return 0;
    }
    
    
    void registo(){
        char novoutiliza[30], novapass[30];
    
    
        printf("|'''''''''''''''|\n");
        printf("| Jogo da Forca |\n");
        printf("|...............|\n\n");
        printf("REGISTO\n\n");
        printf("Introduza o Utilizador: ");
        scanf(" %s", &novoutiliza);
        printf("Introduza a Password: ");
        scanf(" %s", &novapass);
        printf("\nREGISTADO COM SUCESSO");
        getch();
        system("CLS");
        main();
        return 0;}

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Already here -> Hangman game
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Login System
    By legit in forum C++ Programming
    Replies: 6
    Last Post: 11-22-2008, 09:38 AM
  2. simple login program problem
    By suckss in forum C Programming
    Replies: 11
    Last Post: 11-11-2006, 05:02 PM
  3. very noobie simple login
    By limitmaster in forum C Programming
    Replies: 12
    Last Post: 06-12-2006, 04:06 PM
  4. Simple login/password check
    By ceevee in forum C++ Programming
    Replies: 26
    Last Post: 01-17-2005, 12:05 AM
  5. creating a user login system for web pages
    By Nutshell in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 07-04-2002, 11:02 PM

Tags for this Thread