| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 498 人关注过本帖
标题:我写的一个理财系统,有很多BUG,只写了大部份,请大家帮我完善和纠正!
只看楼主 加入收藏
limingzhen90
Rank: 2
等 级:论坛游民
帖 子:53
专家分:72
注 册:2010-12-31
结帖率:100%
收藏
已结贴  问题点数:50 回复次数:6 
我写的一个理财系统,有很多BUG,只写了大部份,请大家帮我完善和纠正!
程序代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>
#include <dos.h>
#define N 12
#include <stdio.h>
#include <conio.h>

static char zhanghao[N],mimao[N],Mimao[N];
static number=0;


 /*菜单*/
void Menu()
{


       int i;
       textattr(109+(BLACK<<3)+(WHITE<<5));
       clrscr();
       gotoxy(10,1);
       cputs("| ------- welcome to you useing it------------------|");
       gotoxy(10,2);
       cputs("| -------please you choice adata to choice----------|");
       gotoxy(10,3);
       cputs("| -------- -----1. 注册 ----------------------------|");
       gotoxy(10,4);
       cputs("| -------- -----2. 登录 ----------------------------|");
       gotoxy(10,5);
       cputs("| ------------- 3. 设置  ---------------------------|");
       gotoxy(10,6);
       cputs("| --------------4. 收支  ---------------------------|");
       gotoxy(10,7);
       cputs("| --------------5. 报表  ---------------------------|");
       gotoxy(10,8);
       cputs("| --------------6. 银行  ---------------------------|");
       gotoxy(10,9);
       cputs("|---------------7.EXIT  ----------------------------|");
       gotoxy(1,12);



   
}

/*注册账号*/
void Register()
{
    int i=0;int j=0;int n=0,len;
    char ch;

    printf("\t\t\t\t请按照提示申请账号!\n\n");
    printf("请输入新的账号:");
    while((zhanghao[n++]=getchar())=='r')
     break;
    printf("请输入密码:");
    for(ch=getch();ch!=13;ch=getch())
    {
        if(j>=N)
        break;
        if(ch=='\b')
        {
          if(j>0)
          {
            printf("\b");
            mimao[--j]='\0';
          }
          putchar(0);
          printf("\b");
          continue;
        }

        printf("*");
        mimao[j++]=ch;
    }
   mimao[j]='\0';
   
   printf("\n请再一次确认密码:");
   for(ch=getch();ch!=13;ch=getch())
   {
     if(i>=N)
     break;
     if(ch=='\b')
     {
       if(i>0)
       {
         printf("\b");
         Mimao[--i]='\0';
       }
       putchar(0);
       printf("\b");
       continue;
     }
     printf("*");
     Mimao[i++]=ch;
   }
    Mimao[i]='\0';

    printf("你已经成功申请\n" );


   /*这里还没有学会怎么弄看两次输入的密码一样*/

  
   
}

/*登录账号*/
void record()
{

    char _mimao[N];char _zhanghao[N];
    int i=0;int j=0;int n=0,len;
    char ch;
    printf("账号:");
    while((_zhanghao[n++]=getchar())=='r')
    break;
    printf("请输入密码:");
    for(ch=getch();ch!=13;ch=getch())
    {
        if(j>=N)
        break;
        if(ch=='\b')
        {
          if(j>0)
          {
            printf("\b");
            _mimao[--j]='\0';
          }
          putchar(0);
          printf("\b");
          continue;
        }

        printf("*");
        _mimao[j++]=ch;
    }
   _mimao[j]='\0';
    

   for(i=0;i<N;i++)
   {
       if((mimao[i]==_mimao[i])&&(zhanghao[i]==_zhanghao[i]))
       continue;
       else
       printf("你的账号或者密码有误,请重新输入");
   }


 }


 /*日期结构*/

 struct Date

 {
   char year[5];
   char month[3];
   char day1[3];

 };


 /*消费结构*/
   struct Daycost
  {
     char name[20];
     int num;
     float price;
     float count;
     struct Date day;
     struct Daycost *next;
  };

/*消费情况链表*/

 struct Daycost *Day_cost()

 {
    struct Daycost *p=(struct Daycost*)malloc(sizeof(struct Daycost));

    printf("商品名字:");

    gets(p->name);
    printf("商品数量:");
    scanf("%d",&p->num);
    printf("请输入商品价格\n");
    scanf("%f",&p->price);
    printf("请输入年份(四位)\n");
    getchar();
    gets(p->day.year);
    while(sizeof(p->day.year)>5)
    {
        printf("输入的格式错误请在输入:");
        gets(p->day.year);
    }
    printf("请输入月份:");
    gets(p->day.month);
    while(strlen(p->day.month)>3)
    {
      printf("输入的格式错误请在输入:");
      gets(p->day.month);
    }
    printf("请输入日子:");
    gets(p->day.day1);
    while(sizeof(p->day.day1)>3)
    {
      printf("输入的格式错误请在输入:");
      gets(p->day.day1);
    }
    p->count=(p->num)*(p->price);

    return p;

 }

/*创建一个日期*/
struct Date *day()
{
  struct Date *q=(struct Date*)malloc(sizeof(struct Date));



 printf("请输入年份\n");


 scanf("%s",&q->year);

 while(sizeof(q->year)>5)

 {
  printf("输入格式不正确,请重新输入\n");
  gets(q->year);

 }


 printf("请输入月份\n");

   

 gets(q->month);

 while(sizeof(q->month)>3)

 {
  printf("输入格式不正确,请重新输入\n");

 }


 printf("请输入日子\n");



 gets(q->day1);

 while(sizeof(q->day1)>3)

 {
  printf("输入格式不正确,请重新输入\n");
  gets(q->day1);

 }

 return q;
}

/*读取消费情况*/
void display(struct Daycost *q)
{

 struct Daycost *p=q;

 if(p==NULL)

 {
  printf("没有消费\n");

 }

 else

 {
  printf("\t年\t月\t日\t名字\t数量\t价格\t总价\n");
  while(p!=NULL)
  {
   printf("\t%s",p->day.year);

   printf("\t%s",p->day.month);

   printf("\t%s",p->day.day1);

   printf("\t%s",p->name);

   printf("\t%d",p->num);

   printf("\t%2.2f",p->price);
   printf("\t%f\n",p->count);

   p=p->next;
  }

 }
}






/*消费情况的录入记录*/
struct Daycost *total_day()
{

 int flag=1;

 char i;

 struct Daycost *head=NULL,*p;


 while(flag)

 {
  printf("请选择:1:输入\t2:结束\n");
  i=getche();
  clrscr();
  if(i=='1')
  {
   if(head==NULL)
   {
    p=Day_cost();
    head=p;
    number++;
   }
   else
   {
    p=Day_cost();
    p->next=head;
    head=p;
    number++;
   }
   flag=1;
  }
  if(i=='2')
  {
   flag=0;
  }

 }

 return head;
}





/*个人收支情况*/
void shouzhi()
{

    char choice;
    struct Daycost *p;
    struct Date *q;
    int n=1;
    float sum;


      

    while(n)
    {
       clrscr();
       printf("\t\t\t1:数据的录入\n\n");

       printf("\t\t\t2:查找某天的消费情况\n\n");

       printf("\t\t\t3:查看在记录天数中总的消费金额\n\n");

       printf("\t\t\t4:写入文件\n\n");

       printf("\t\t\t5:从文件中读写\n\n");

       printf("\t\t\t6:退出\n");

       printf("\n\t\t\t请在1~6之间选择\n");

       choice=getche();
       clrscr();

       switch(choice)
      {
        case'1':p=total_day(); display(p); system("pause");break;
        case'2':q=day(); break;
        case'6':n=0; break;

      }
    }



}



/*主函数*/
void main(void)

{
   int n=1;
   while(n)
   {

     char choice;

     Menu();
     choice=getche();
     clrscr();
      

     switch(choice)
     {
        case '1' :Register();system("pause");break;
        case '2' :record();  system("pause");break;
        case '4' :shouzhi(); system("pause");break;
        case '7' :n=0;                       break;
        default :printf("error please again input");
     
     }
   }

 }    
密码问题我不会弄,还有就是单键表问题,为什么我读入数据了,读不出来(部份),真的是有很多不懂,我还没有写完,可以运行,大家帮忙纠正下,那里需要改的,大家给点意见和代码。。。。谢谢了
搜索更多相关主题的帖子: 理财 
2011-03-03 19:20
qq1023569223
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:湖南科技大学
等 级:贵宾
威 望:26
帖 子:2753
专家分:13404
注 册:2010-12-22
收藏
得分:7 
我用VC,不懂上面的程序,主要是程序太长,不是自己写的话,不好理解,当然不好改了。
如何让密码配对(两次输入的密码相同),假如strcmp(str1,str2)==0说明字符串str1和字符串str2一样的。

[ 本帖最后由 qq1023569223 于 2011-3-4 11:56 编辑 ]

   唯实惟新 至诚致志
2011-03-03 19:29
limingzhen90
Rank: 2
等 级:论坛游民
帖 子:53
专家分:72
注 册:2010-12-31
收藏
得分:0 
回复 楼主 limingzhen90
怎么都没有人回复呢?
是不是我程序运行不了呢?
我是在win-tc下运行的

入门了吗?
2011-03-03 19:35
mandown1991
Rank: 4
等 级:业余侠客
帖 子:262
专家分:252
注 册:2011-3-2
收藏
得分:7 
好像是运行不了啊!
2011-03-03 23:54
pangding
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:北京
等 级:贵宾
威 望:94
帖 子:6784
专家分:16751
注 册:2008-12-20
收藏
得分:7 
大家没有 TC 的可能性还是比较大的,我觉得。
2011-03-04 21:14
vandychan
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
等 级:贵宾
威 望:18
帖 子:2296
专家分:6418
注 册:2010-8-20
收藏
得分:7 
好 什么时候??

到底是“出来混迟早要还”还是“杀人放火金腰带”?
2011-03-04 21:15
thlgood
Rank: 5Rank: 5
等 级:职业侠客
帖 子:281
专家分:381
注 册:2010-9-24
收藏
得分:7 
我来试试吧!

o(∩∩)Linux & Python 群:187367181
2011-03-04 21:23
快速回复:我写的一个理财系统,有很多BUG,只写了大部份,请大家帮我完善和纠正 ...
数据加载中...
 
   



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

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