0

I'm trying to update it from using the string library to using char*, but it keeps giving me an error while trying to use get_char while compiling.

#include <stdio.h> #include <stdlib.h> #include <ctype.h>

#define MAX 13; #define MIN 8;

//points assigne for lettering int POINTS[] = {1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10};

int main(void) { //Asking client for password entry char* password = get_char("What is your Password?: ");

if(strlen(password) > MAX)
{
    printf("Usage, Password is too long. Must be no more than 13 Characters\n");
    return 1;
}

if(strlen(password) < MIN)
{
    printf("Usage, Password is too short. Must be at least 8 Characters\n");
    return 1;
}

int score =0;

for(int i = 0; i < strlen(password); i++)
{
    if(isupper(password[i]))
    {
        score += POINTS[password[i]-65];
    }
    else if(islower(password[i]))
    {
        score += POINTS[password[i]-97];
    }
    return score;
}
printf("Password score: %i\n", password);

}

1 Answer 1

0

get_char is a function in the CS50 library; to use it, cs50.h needs to be included. Here is one place to start if you don't want to use the cs50 library at all.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .