标题:求指错加编码
取消只看楼主
至尊灬帝豪
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2016-11-22
结帖率:100%
已结贴  问题点数:13 回复次数:1 
求指错加编码
#include <stdio.h>
#include <stdlib.h>
struct
{
    char name;
    int money;
    int initialPassword[];
} customer;
data()
{
    customer.name="张三";
    customer.money=10000;
    customer.initialPassword;
}
int inquisy()
{
    data();
    int i;
    printf("\t\t\t   姓名:%s\n",customer.name);
    printf("\t\t\t   余额: %d\n",customer.money);
    printf("按0返回上一层\n");
    while(i!=0)
    {
        scanf("%d",&i);
        printf("请重新输入\n");
    }
    function();
    return data;
}
int  depositMoney()
{
    data();
    int add;
    int i;
    printf("请输入需要充值的面额\n");
    scanf("%d",&add);
    while((add%100)!=0)
    {
        printf("请输入整百的面额\n");
        scanf("%d",&add);
    }
    customer.money=customer.money+add/4;
    printf("您的余额为:%d\n",customer.money);
    printf("按0返回上一层\n");
    while(i!=0)
    {
        scanf("%d",&i);
        printf("请重新输入");
    }
    function();
    return customer.money;
}
int  withdrawMoney() {}
int transferAccounts() {}
void changePasswords()
{
    /*inputPassword(number[6]);
    int number0[6];
    int i=0;
    printf("\t\t\t\t请输入密码\n");
    scanf("%d",&number0[6]);
    //printf("初始密码000000\n");
    /* while(number)
     {
         scanf("%d",&number[6]);
         if(number[6]==000000)
         {
             printf("\n\n\n请输入新的密码");
             break;
         }
         else
         {
             printf("密码错误,请重新输入\n");
         }
     }

    if(number0[6]==number[6])
    {
        printf("输入错误,无可与旧密码相同\n");
        changePasswords();
    }
    else
    {
        printf("新密码输入成功\n");
    }
    printf("按0放回上一程");
    scanf("%d",&i);
    if(i==0)
    {
        function();
    }
    else
        printf("请重新输入");*/
}
void functionValue()
{
    int i=0;
    scanf("%d",&i);
    if(i>0&&i<6)
    {
        switch(i)
        {
        case 1:
            inquisy();
            break;
        case 2:
            depositMoney();
            break;
        case 3:
            withdrawMoney();
            break;
        case 4:
            transferAccounts();
            break;
        case 5:
            changePasswords();
            break;
        }
    }
    else
    {
        printf("请重新输入\n");
        functionValue();
    }
}
void function()
{
    printf("\t\t\t    需要使用的功能:\n");
    printf("\t\t1.查询");
    printf("\t\t\t2.存款\n");
    printf("\t\t3.取款");
    printf("\t\t\t4.转账\n");
    printf("\t\t5.更改密码\n");
    functionValue();

}
void inputPassword()
{
    int isHas=0;
    int number[6];
    int initialPassword[]= {0,0,0,0,0,0};
    int i=0,j=0,s=0;
    printf("初始密码000000\n");
    printf("\t\t\t\t请输入密码\n");

    for(i=0; i<6; i++)
    {
        scanf("%d",&number[i]);
    }
    for(j=0; j<6; j++)
    {

        if(number[j]==initialPassword[j])
        {
            isHas=1;
        }
        else
        {
            isHas=0;
            printf("请重新输入\n");
            inputPassword();
        }
    }

    if(isHas==1)
        function();
}

void mainMenu()
{
    int isHas=0;
    printf("\t\t\t\    欢迎使用湖南农大存取款机\t\t\n\n\n");
    printf("\t\t\t\t ------------\t\t\t\n");
    printf("\t\t\t\t|  请插入卡  |\t\t\t\n");
    printf("\t\t\t\t ------------\t\t\t\n");
    system("pause");
    inputPassword();
}
int main()
{
    int password[]= {0,0,0,0,0,0};
    mainMenu();
    return 0;
}




存款过后 在查询依旧是1000,
搜索更多相关主题的帖子: int printf scanf 输入 number 
2018-01-04 22:17
至尊灬帝豪
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2016-11-22
得分:0 
回复 2楼 吹水佬
怎么改呢
2018-01-05 09:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-483982-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.391462 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved