Python数据分析(一)

您所在的位置:网站首页 懊恼怎么造句子 Python数据分析(一)

Python数据分析(一)

2024-07-04 02:20:30| 来源: 网络整理| 查看: 265

13、Mybatis把返回结果封装成map类型

沐阳0909: @MapKey("name") 太好用了

springboot整合mybatis-generator报错:Failed to execute goal org.mybatis.generatormybatis-generator-

Growing Hacker: 非常感谢,终于找到这个坑了

图书管理系统(大一C语言大作业 包含主要结构体,文件操作, 如数据的修改 查询 删除等)

m0_74832945: #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #define LEN sizeof(book) typedef struct book //确认结构体 { char id[8]; char name[31]; char author[27]; char publish[31]; double price; }book; void Menu1();//标题函数 void Menu2();//菜单函数 void WriteToFile();//书籍信息输入的函数 void ReadFromFile();//显示所有信息的函数 void QueryFile();//书籍的查询函数 void ModifyFile();//书籍的修改函数 void DeletFile();//删除数据的函数 int main() { int select; do { Menu1(); Menu2(); scanf("%d", &select); switch (select) { case 1: WriteToFile(); break; case 2: ReadFromFile(); break; case 3: QueryFile(); break; case 4: ModifyFile(); break; case 5: DeletFile(); break; default: printf("退出程序!"); exit(0); break; } }while ((select == 1 || select == 2)||(select == 3|| select == 4)||( select == 5)); return 0; }//利用switch函数进行菜单的选择 void Menu1() { system("mode con cols=54 lines=30"); system("color F2"); printf("**********欢迎使用长沙理工大学图书管理系统*********** "); }//标题函数1 void Menu2() { printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); printf(" 1.录入图书 "); printf(" 2.显示图书 "); printf(" 3.查询图书 "); printf(" 4.修改图书 "); printf(" 5.删除图书 "); printf(" 0.退出 "); printf(" 输入你的操作:"); }//标题函数2 void WriteToFile() { FILE *fp = NULL; book stu; char flag = 'y'; fp = fopen("book1.dat", "ab+");//打开文件 if (fp == NULL) { printf("文件打开失败! "); exit(1);//1表示在有错的方式退出程序 } while ((flag == 'y' || flag == 'Y')) { system("cls"); Menu1(); printf("请输入图书id:"); scanf("%s", stu.id); printf("请输入书名:"); scanf("%s", stu.name); printf("请输入书籍作者:"); scanf("%s", &stu.author); printf("请输入出版社:"); scanf("%s", &stu.publish); printf("请输入价格:"); scanf("%lf", &stu.price); fwrite(&stu, LEN, 1, fp); fflush(stdin); printf("继续输入吗?继续请输入y或Y:"); getchar(); scanf("%c", &flag); } fclose(fp);//关闭文件 return; }//图书添加的函数 void ReadFromFile() { system("cls"); Menu1(); FILE *fp = NULL; book stu; fp = fopen("book1.dat", "rb"); if (fp == NULL) { printf("文件打开失败"); exit(1); } printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); printf(" id 书名 作者 "); fseek(fp, 0, SEEK_SET); while (!feof(fp)) { if (fread(&stu, LEN, 1, fp)) { printf("%10s %8s %5s ", stu.id, stu.name, stu.author); } } printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); system("pause"); system("cls"); fclose(fp); return; } void QueryFile() { system("cls"); Menu1(); book stu; char x[8]; int flag = 0; FILE *fp; printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); printf(" 请输入图书id:"); scanf("%s", x); printf(" ID 书名 作者 出版社 价格 "); fp = fopen("book1.dat", "rb"); if (fp == NULL) { printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); printf("错误 "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); return; } fseek(fp, 0, SEEK_SET); while (fread(&stu, LEN, 1, fp)) { if (strcmp(x, stu.id) == 0) { printf("%3s %5s %5s %10s %5.2lf ", stu.id, stu.name, stu.author, stu.publish, stu.price); flag = 1; } if (flag = 0) { printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); printf("没有图书信息"); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); } } printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); fclose(fp); system("pause"); system("cls"); return; } void ModifyFile() { system("cls"); Menu1(); book stu; FILE *fp; char x[8]; printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); printf("请输入图书id:"); scanf("%s", x); fp = fopen("book1.dat", "rb+"); if (fp == NULL) { printf("文件打开失败"); exit(1); } fseek(fp, 0, SEEK_SET); while (fread(&stu, LEN, 1, fp)) { if (strcmp(x, stu.id) == 0) { printf("请重新输入图书id: "); scanf("%s", stu.id); printf("请重新输入书名: "); scanf("%s", stu.name); printf("请重新输入书籍作者 : "); scanf("%s", &stu.author); printf("请重新输入图书出版社 : "); scanf("%s", &stu.publish); printf("请重新输入图书价格 : "); scanf("%lf", &stu.price); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); fflush(stdin); fseek(fp, 0-LEN, SEEK_CUR); fwrite(&stu, LEN, 1, fp); fclose(fp); } if (feof(fp)) { printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); printf("没有图书信息"); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "); } } system("pause"); system("cls"); return; } void DeletFile() { system("cls"); Menu1(); book s; FILE* fp; char a[10]; fp = fopen("book1.dat", "rb+"); if (fp == NULL) { printf("打开文件错误!!! "); exit(1); } printf(" 请输入图书ID:"); scanf("%s", a); printf(" 删除成功 "); fseek(fp, 0, SEEK_SET); FILE* fp1; fp1 = fopen("linshi.dat", "ab+");//读写新建一个临时文件 while (fread(&s, LEN, 1, fp))//从原文件读一个结点 { if (strcmp(a, s.id) != 0)//不是要删除的内容 { fwrite(&s, LEN, 1, fp1); } } fclose(fp); fclose(fp1); remove("book1.dat");//删除原文件 rename("linshi.dat", "book1.dat");//重命名为原文件 fflush(stdin); system("pause"); system("cls"); return; }

vue-baidu-map使用方法(简单快速)在vue项目中使用

taurus102: 请问 vue-baidu-map 是哪个版本?

Luckysheet 导入导出 - Java后台处理和js前端实现

奥斑马李: 项目为什么访问不了



【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭