Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8869531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:30:00+00:00 2026-06-14T17:30:00+00:00

I have used an else..if statement in my program to check if certain conditions

  • 0

I have used an else..if statement in my program to check if certain conditions are met in the validation but I think I have an error in the layout of my else..if statement that I can’t seem to pinpoint.Can someone point me in the right correction or give me some helpful tips on what I should do in this situation?Thanks.

void validatePass()
{
    FILE *fptr;
    char password[MAX+1];
    int iChar,iUpper,iLower,iSymbol,iNumber,iTotal,iResult,iCount;


    //shows user password guidelines
    printf("\n\n\t\tPassword rules: ");
    printf("\n\n\t\t 1. Passwords must be at least 9 characters long and less than 15 characters. ");
    printf("\n\n\t\t 2. Passwords must have at least 2 numbers in them.");
    printf("\n\n\t\t 3. Passwords must have at least 2 uppercase letters and 2 lowercase letters in them.");
    printf("\n\n\t\t 4. Passwords must have at least 1 symbol in them (eg ?, $, £, %).");
    printf("\n\n\t\t 5. Passwords may not have small, common words in them eg hat, pow or ate.");

    //gets user password input

    printf("\n\n\t\tEnter your password following password rules: ");
    scanf("%s", &password);


    iChar = countLetters(password,&iUpper,&iLower,&iSymbol,&iNumber,&iTotal);

    if(iUpper < 2)
    {
        printf("Not enough uppercase letters!!!\n");

    }

    else if(iLower < 2)
    {
        printf("Not enough lowercase letters!!!\n");

    }
    else if(iSymbol < 1)
    {
        printf("Not enough symbols!!!\n");

    }
    else if(iNumber < 2)
    {
        printf("Not enough numbers!!!\n");

    }
    else if(iTotal < 9 && iTotal > 15)
    {
        printf("Not enough characters!!!\n");

    }

    iResult = checkWordInFile("dictionary.txt",password);

    if( iResult == gC_FOUND )
    {
        printf("\nFound your word in the dictionary");
    }

    else if
    {
        printf("\nCould not find your word in the dictionary");
    }

    iResult = checkWordInFile("passHistory.txt",password);

    if( iResult == gC_FOUND )
    {
        printf("\nPassword used");

    }

    else if
    {
        printf("\nOk to use!");
    }

    printf("\n\n\n Your new password is verified ");
    printf(password);

    //writing password to passHistroy file.


    fptr = fopen("passHistory.txt", "w");   // create or open the file
    for( iCount = 0; iCount < 8; iCount++)
    {
        fprintf(fptr, "%s\n", password[iCount]);
    }

    fclose(fptr);

    printf("\n\n\n");
    system("pause");


}//end validatePass method
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:30:02+00:00Added an answer on June 14, 2026 at 5:30 pm

    There’s no else if, just else if () .... Well, to put it nicely, you can’t have an if without a condition afterwards. Otherwise, you’re just leaving the compiler wondering "if what?".

    wrong

    if (...)
    {
    }
    else if
    {
        printf("\nCould not find your word in the dictionary");
    }
    

    okay

    if (...)
    {
    }
    else 
    {
        printf("\nCould not find your word in the dictionary");
    }
    

    also okay

    if (...)
    {
    }
    else if(condition)
    {
        printf("\nCould not find your word in the dictionary");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used a plugin that uses prototype js, it's working fine but the
I've used the contains() function successfully, but never have used it with an if-statement
I have used the silverlight control in CRM 2011.It also published on form but
We have used Shibboleth to authenticate users. It works great. The issue is that
I have used NSSets many times in my apps, but I have never created
I have used auto complete textbox previously. That auto complete works only when i
I have used geocoder in my ruby on rails application for a while but
I have the following PLINQ statement in a C# program: foreach (ArrestRecord arrest in
I have gotten this to work nicely, but when speed hits a certain speed
I have this function here that assembles an API call to eBay. It used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.