鱼C论坛

 找回密码
 立即注册
查看: 2266|回复: 7

[已解决]求助一个机房收费管理系统的源代码

[复制链接]
发表于 2019-6-10 14:47:54 From FishC Mobile | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
虽然知道这样直接伸手不太好
没有大佬提供的话那就自己打了
来自: 微社区
最佳答案
2019-6-11 21:01:35
 printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].id);
                printf("\n\t请输入第%d个学生班级:",i);
                scanf("%s",student[i-1].theclass);
                printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].name);
                printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].ontime);
因为你把时间和姓名写成了学号
中途退出功能你可以设置一个特殊按键,若输入为该按键时回到主界面。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2019-6-10 15:19:08 | 显示全部楼层
那就自己打吧

点评

行吧  发表于 2019-6-10 15:27
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2019-6-10 16:00:05 | 显示全部楼层
你先打,我帮你改bug

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-6-11 20:05:11 | 显示全部楼层
TOP_LK 发表于 2019-6-10 16:00
你先打,我帮你改bug
#include<time.h>
#include<stdio.h>
#include<string.h>
#include<Windows.h>
#define N 20
#define M 100
struct student
{
        char id[N];
        char theclass[N];
        char name[N];
        char ontime[N];
} student[M];
int n;
void addition()
{
        int i;
        printf("\n请输入入录学生信息在总数:");
        scanf("%d",&n);
        for(i=1;i<=n;i++)
        {
                printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].id);
                printf("\n\t请输入第%d个学生班级:",i);
                scanf("%s",student[i-1].theclass);
                printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].name);
                printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].ontime);
                printf("\n\t提示:您已经成功录入第%d条信息\n",i);
        }
}
void calculate()
{
        int hours;
        char times[30];time_t rawtime;
        struct tm*timeinfo;
        time(&rawtime);
        timeinfo=localtime(&rawtime);
        strcpy(times,asctime(timeinfo));
        printf("\t所有学生上机费用如下:\n");
        for(int i=1;i<=n;i++)
        {
                printf("学生%d费用:",i);
                if((student[i-1].ontime[3]-48)*10+student[i-1].ontime[4]>(times[14]-48)*10+times[15])hours=(times[11]-48)*10+times[12]-(student[i-1].ontime[0]-48)*10-student[i-1].ontime[1];
                else
                        hours=(times[11]-48)*10+times[12]-(student[i-1].ontime[0]-48)*10-student[i-1].ontime[1]+1;
                printf("%d\n",hours);
        }
}
void search()
{
        int i,b,c,count;
        do
        {
                char find[20];
                printf("\n请选择查询方式:1.根据学号查询;2.根据班级查询;3.根据姓名查询;4.根据上机时间:");
                scanf("%d",&b);
                switch(b)
                {
                        case 1 : count=PF_FLOATING_POINT_PRECISION_ERRATA;
                                         printf("\n**请输入学生的学号:");
                                         scanf("%s",find);
                                         for(i=0;i<n;i++)
                                         {
                                                if(strcmp(student[i].id,find)==0)
                                                {
                                                count++;
                                                if (count==PF_FLOATING_POINT_EMULATED)
                                                        printf("学生学号\t学生班级\t学生姓名\t上机时间\n");
                                                printf("%8s%15s%15s%17s",student[i].id,student[i].theclass,student[i].name,student[i].ontime);
                                                }
                                         }
                                         if(!count)
                                                 printf("****提示:该学生不存在");
                                         goto A;
                        case 2 :count=PF_FLOATING_POINT_PRECISION_ERRATA;
                                printf("\n**请输入学生的班级:");
                                scanf("%s",find);
                                for(i=0;i<n;i++)
                                         {
                                                if(strcmp(student[i].id,find)==0)
                                                {
                                                count++;
                                                if (count==PF_FLOATING_POINT_EMULATED)
                                                        printf("学生学号\t学生班级\t学生姓名\t上机时间\n");
                                                printf("%8s%15s%15s%17s",student[i].id,student[i].theclass,student[i].name,student[i].ontime);
                                                }
                                         }
                                         if(!count)
                                                 printf("****提示:该学生不存在");
                                         goto A;
                                case 3 :count=PF_FLOATING_POINT_PRECISION_ERRATA;
                                printf("\n**请输入学生的姓名:");
                                scanf("%s",find);
                                for(i=0;i<n;i++)
                                         {
                                                if(strcmp(student[i].id,find)==0)
                                                {
                                                count++;
                                                if (count==PF_FLOATING_POINT_EMULATED)
                                                        printf("学生学号\t学生班级\t学生姓名\t上机时间\n");
                                                printf("%8s%15s%15s%17s",student[i].id,student[i].theclass,student[i].name,student[i].ontime);
                                                }
                                         }
                                         if(!count)
                                                 printf("****提示:该学生不存在");
                                         goto A;
                                case 4 :count=PF_FLOATING_POINT_PRECISION_ERRATA;
                                printf("\n**请输入学生的上机时间:");
                                scanf("%s",find);
                                for(i=0;i<n;i++)
                                         {
                                                if(strcmp(student[i].id,find)==0)
                                                {
                                                count++;
                                                if (count==PF_FLOATING_POINT_EMULATED)
                                                        printf("学生学号\t学生班级\t学生姓名\t上机时间\n");
                                                printf("%8s%15s%15s%17s",student[i].id,student[i].theclass,student[i].name,student[i].ontime);
                                                }
                                         }
                                         if(!count)
                                                 printf("****提示:该学生不存在");
                                         goto A;
                                default:printf("****提示:该学生不存在");

                }
                A:printf("\n\t**1.继续\n\t**0.返回主菜单");
                  printf("\n\t 请输入您的选择:");
                  scanf("%d",&c);
        }
        while(c);
}
void menu()
{
        printf("\n\t*******************欢迎进入机房收费管理系统!*******************\n");
        printf("\t**1.录入功能**\n");
        printf("\t**2.计算功能**\n");
        printf("\t**3.查询功能**\n");
        printf("\t**4.***EXIT***\n");
        printf("\n\t请输入您的选择:");
}
void main()
{
        system("color 5f");
        int a;
        C:menu();
          scanf("%d",&a);
          switch(a)
          {
          case 4 :printf("***正在退出**谢谢使用本系统,再见");break;
          case 1 :addition();
                  goto C;
          case 2 :calculate();
                  goto C;
          case 3 :search();
                  goto C;
          }
}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-6-11 20:08:09 | 显示全部楼层
TOP_LK 发表于 2019-6-10 16:00
你先打,我帮你改bug

这个我不知道为啥我录入学生的时候他只有学号和班级,没有了上机时间和姓名。还有就是我想插入一个中途退出选项,不知道要咋插入
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2019-6-11 21:01:35 | 显示全部楼层    本楼为最佳答案   
 printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].id);
                printf("\n\t请输入第%d个学生班级:",i);
                scanf("%s",student[i-1].theclass);
                printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].name);
                printf("\n\t请输入第%d个学生学号:",i);
                scanf("%s",student[i-1].ontime);
因为你把时间和姓名写成了学号
中途退出功能你可以设置一个特殊按键,若输入为该按键时回到主界面。

点评

......好,谢谢大佬  发表于 2019-6-11 23:43
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-3 21:22

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表