This is a part of my project.
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.
Can you help me? Thank you
__________________________________________________ _____
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;