Petit Ours
10-29-2012, 05:12 PM
Hello guys :D I have an homework for college and i dont understand how to do it :/
i need to create a program in C:
-The program have to ask to the user what is his user name and his password that he want to create.
- When the user will enter his password, * this character need to replace the letter and the program need to ask the password twice to be sure its right.
- If there is already a user and the good password have been enter, the user account can be replace by another one else it cannot.
This is only a small part of my work but i cant figure out how to create it :/
Please help me fast :D
DarkstaR
Syntax
Forgee
this is what i have done so far :/
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
int main(void)
{
int mdp[15];
int user[10];
int choix,i;
char c;
do
{
printf("\nMENU\n");
printf("A) Créer compte\n");
printf("B) Créer combinaisons (max de 5)\n");
printf("C) Afficher combinaisons\n");
printf("D) Combinaison gagnante\n");
printf("E) Validation\n");
printf("F) Nouveau tirage\n");
printf("Q) Quitter\n");
choix=toupper(getch());
switch(choix)
{
case 'A':
printf("Choississez le nom de votre compte:");
scanf("%s",user);
printf("Choississez votre mot de passe:");
c = getch();
for(i=0;i<15;i++)
{
do
{
if(c<=33 && c<=126)
{
printf("*");
}
}while (c !=13);
}
}while(choix!='Q');
return 0;
}
i need to create a program in C:
-The program have to ask to the user what is his user name and his password that he want to create.
- When the user will enter his password, * this character need to replace the letter and the program need to ask the password twice to be sure its right.
- If there is already a user and the good password have been enter, the user account can be replace by another one else it cannot.
This is only a small part of my work but i cant figure out how to create it :/
Please help me fast :D
DarkstaR
Syntax
Forgee
this is what i have done so far :/
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
int main(void)
{
int mdp[15];
int user[10];
int choix,i;
char c;
do
{
printf("\nMENU\n");
printf("A) Créer compte\n");
printf("B) Créer combinaisons (max de 5)\n");
printf("C) Afficher combinaisons\n");
printf("D) Combinaison gagnante\n");
printf("E) Validation\n");
printf("F) Nouveau tirage\n");
printf("Q) Quitter\n");
choix=toupper(getch());
switch(choix)
{
case 'A':
printf("Choississez le nom de votre compte:");
scanf("%s",user);
printf("Choississez votre mot de passe:");
c = getch();
for(i=0;i<15;i++)
{
do
{
if(c<=33 && c<=126)
{
printf("*");
}
}while (c !=13);
}
}while(choix!='Q');
return 0;
}