c programming(fast and small)

Completed Posted 5 years ago Paid on delivery
Completed Paid on delivery

can we add it to the program now during 30 minutes?

just adds the possibility for to specify how many users and passwords that will be needed. Continue to build this from your [EA2a-b] project. Here’s an example run: How many users and passwords? 4 Enter a username: Alice Enter a password: ABc12345 This is a valid password. Confirm by entering it again: Confirm password: ABc12345 Password ABc12345 is associated with user: Alice. … (continued 3 times) Rules and Implementation The idea here is that the user should be asked for amount of user accounts. Instead of having an array of three users, you should replace this with a dynamic array and allocate the number of user accounts indicated by the user. This is a quite small modification of the original program since dynamical arrays works just as static ones. Remember to free the allocated memory at the end of the program1

#include <stdio.h>

#include <string.h>

/* Some consants that represents a boolean */

#define TRUE 1

#define FALSE 0

#define MAX_PASSWORD_LEN 255

/* Check if the password is safe or not */

int is_safe_password(char *password)

{

int has_number;

int has_lower_case;

int has_upper_case;

int i;

/* A password has to have at least characters to be safe */

if (strlen(password) < 8)

 return FALSE;

/* A password has to have at least 1 number, 1 upper case, and 1 lower case

to be considered safe */

has_number = FALSE;

has_lower_case = FALSE;

has_upper_case = FALSE;

for (i = 0; i < (signed) strlen(password); i++)

{

 if (password[i] >= '0' && password[i] <= '9')

  has_number = TRUE;

 else if (password[i] >= 'A' && password[i] <= 'Z')

  has_upper_case = TRUE;

 else if (password[i] >= 'a' && password[i] <= 'z')

  has_lower_case = TRUE;

}

return has_number && has_lower_case && has_upper_case;

}

/* Create a valid password for the user */

void create_password(int user_i, char passwords[3][MAX_PASSWORD_LEN])

{

char password[MAX_PASSWORD_LEN];

while (TRUE)

{

 /* Get a password */

 printf("User %d, enter your password: ", user_i + 1);

 fgets(passwords[user_i], MAX_PASSWORD_LEN, stdin);

 passwords[user_i][strlen(passwords[user_i]) - 1] = '\0';

 /* Validate the password */

 if (is_safe_password(passwords[user_i]))

 {

  /* Confirm password */

  printf("Your password is safe, retype password to confirm: ");

  fgets(password, MAX_PASSWORD_LEN, stdin);

  password[strlen(password) - 1] = '\0';

  if (strcmp(passwords[user_i], password) == 0)

  {

C Programming C# Programming C++ Programming PHP Software Architecture

Project ID: #18479270

About the project

5 proposals Remote project Active 5 years ago

Awarded to:

Makaronii

Hi, I am able to write this to you in 30 minutes :) Talk to priv :) Regards, Kowalski Marek :) ---------------------------------------------------------------

$25 USD in 0 days
(2 Reviews)
1.5

5 freelancers are bidding on average $25 for this job

VladimirLilenko

Hello, dear sir! I registered at the forum not so long ago, but I already have several completed projects on www.freelancer.com. I am ready to carry out your project in the reasonable price and in the shortest possibl More

$30 USD in 1 day
(22 Reviews)
4.6
bomerb

Hello. I can start immediately and deliver your project in short. We can talk all details before I begin. Hope to work with you.

$20 USD in 1 day
(14 Reviews)
3.8
heem42

I have been working in C and C++ for a long time now and pretty sure I will be able to help you out with this one. I promise to give you best quality work. Lets discuss further in chat.

$25 USD in 1 day
(10 Reviews)
3.3
HoneyApplePie

Hello Dear I am expert in PHP ,codeignitor, Mysql , HTML , CSS , Javascript , Jquery , AJAX , web development. PHP - Expert! With proven experience. REPLY :- We have approx 7+ year of experience. *JS - Expert! With p More

$25 USD in 14 days
(4 Reviews)
2.3