虽然声明了未声明变量的错误

时间:2015-08-02 10:01:11

标签: visual-c++

#ifndef User_h
#define User_h
#include "User.h"
#include "pass_exists.h"
#endif
#include "pass_Recovery.h"
int wrong_password(User *data_base,char *username)
{
    char pass[9];
    char option;
    int i=0,pass_validation=2;

    while(1)
        {
        printf("%s the password is incorrect!\n\n",username);
        printf("Please choose an option:\n");
        printf("To try your password again enter '1'.\n");
        printf("If you forgot your password enter '!'.\n");
        printf("To go back to the first screen enter '#'.\n");
        printf("To Exit the app please enter '$'.\n\n");
        printf("Input: ");
        scanf(" %c",&option);
        printf("\n\n=========================================================================\n\n\n");

        if(option=='#')
        {
            printf("\n\n=========================================================================\n\n\n");
            return 0;//return to Main screen
        }
        if(option=='$')
            return 3;//exiting the app
        if(option=='1')
        {
            printf("\n\n=========================================================================\n\n\n");
            printf("Please enter your password:\n");
            printf("Input: ");
            scanf("%s",&pass);
            pass_validation=pass_exists(data_base,username,pass);
            if(pass_validation==1)
                printf("Nice");
                //profile() user name and password were confirmed
            else
            {
              printf("Password is wrong!\n");
              printf("\n\n=========================================================================\n\n\n");
              continue;
            }
        }
        if(option=='!')
            return pass_Recovery(data_base,username);
    }
}

所以我得到了vars的未声明变量的错误:pass和option。 代码(在我看来)非常清楚,所以我认为没有语法错误。

我也错了,说我想念';'在类型之前(对于第7,10,11行),这通常发生在您忘记放置';'时声明后,但似乎并非如此:。

非常感谢你的帮助。

0 个答案:

没有答案