经过几个星期的奋战,我们三人终于把课设弄完了,在体验了成功的快感的同时也感受到了debug的痛苦与煎熬,幸而检查的时候程序没有挂,自觉写的还可以,所以扔上来纪念一下
// main.c
#include <stdio.h>
#include "function.h"
#include "tool_f.h"
#include "console_output_control.h"
int main() {
Init();
int isRun [FUNCNUM] = {
0};
int state = 1;
pCls p = CreateClass();
while (state) {
Cls();
printf("*****************************************************************************\n");
printf("* 1. Read from a file *\n");
printf("* 2. Append record manually *\n");
printf("* 3. Calculate total and average score of every course *\n");
printf("* 4. Calculate total and average score of every student *\n");
printf("* 5. Sort in descending order by total score of every student *\n");
printf("* 6. Sort in ascending order by total score of every student *\n");
printf("* 7. Sort in ascending order by number *\n");
printf("* 8. Sort in dictionary order by name *\n");
printf("* 9. Search by number *\n");
printf("* 10. Search by name *\n");
printf("* 11. Statistic analysis for every course *\n");
printf("* 12. List record *\n");
printf("* 13. Write to a file *\n");
printf("* 14. Correct the information of a student *\n");
printf("* 0 . Exit *\n");
printf("*****************************************************************************\n\n");
printf(" Please input your choice: \n\n");
printf(" ");
scanf("%d",&state);
TurnPage(state);
if (!IsRun(isRun,state,p)) {
continue ;
}
switch (state) {
case 0 :
isRun[0] = 1;
Free(p);
EndPut();
break;
case 1 :
if (Input(p) == 0)
isRun[1] = 1;
break;
case 2:
if (ManualInput(p)==0)
isRun[2] = 1;
break;
case 3:
isRun[3] = 1;
ScoreofCrs(p);
break;
case 4:
isRun[4] = 1;
ScoreofStu(p);
break;
case 5:
isRun[5] = 1;
SortbyDScore(p);
break;
case 6:
isRun[6] = 1;
SortbyAScore(p);
break;
case 7:
isRun[7] = 1;
SortbyNum(p);
break;
case 8:
isRun[8] = 1;
SortbyName(p);
break;
case 9:
isRun[9] = 1;
printf("Please input the Stu No. you want:\n");
int no;
scanf("%d",&no);
pStu pstu = SearchNum (p,no);
if (pstu == NULL) {
TurnPage(-1);
printf("No such a student!\n");
} else {
PrintListboard(p->sumcrs);
PrintStu(&pstu->data,p->sumcrs);
}
break;
case 10:
isRun[10] = 1;
printf("Please input the name you want:\n");
char s[NAMEMAX+1];
getchar();
gets(s);
pstu = SearchName (p->inf.head->next,s);
if (pstu == NULL) {
TurnPage(-1);
printf("No such a student!\n\n");
break;
}
PrintListboard(p->sumcrs);
while (pstu)
{
PrintStu(&pstu->data,p->sumcrs);
pstu = SearchName(pstu->next,s);
}
break;
case 11:
isRun[11] = 1;
Analysis(p);
break;
case 12:
isRun[12] = 1;
ListRecord(p);
break;
case 13:
isRun[13] = 1;
WtF(p);
break;
case 14:
isRun[14] = 1;
Correct(p);
break;
default :
printf("ERROR ! NO SUCH A CHOICE! \n");
printf("Please input your choice again:\n");
}
}
return 0;
}
//function.h
/* 1. Read from a file
* 2. Append record manually
* 3. Calculate total and average score of every course
* 4. Calculate total and average score of every student
* 5. Sort in descending order by total score of every student
* 6. Sort in ascending order by total score of every student
* 7. Sort in ascending order by number
* 8. Sort in dictionary order by name
* 9. Search by number
* 10. Search by name
* 11. Statistic analysis for every course
* 12. List record
* 13. Write to a file
* 14. Correct the information of a student that has already been stored
* 0 . Exit
*/
#define STUNOMAX 10 // Max of length of Stu No.
#define NAMEMAX 20 // Max of length of name
#define SUBMAX 6 // Max of subjects
#define STUMAX 30 // Max of students in a class
#define FILENAMEMAX 32 //Max of filename
#define RANKLEN 6 // Length of rank for output
#define SUMLEN 8 // Length of sum for output
#define AVERLEN 10 // Length of average for output
#define CRSLEN 10 // Length of course for output
#define MALLOCERR 1 // the num exit() use when malloc() errors occur
#define FUNCNUM 14 // num of functions in function.h
typedef struct {
int stunum; // student number
int rank; // rank in the class
char name[NAMEMAX+1]; // namelist
double score[SUBMAX+2]; // score of each subject, score[0] is the sum and score[sumcrs+1] is the average
} Data,*pData;
typedef struct Node { // Node of linked list
Data data;
struct Node *next;
} Student,*pStu;
typedef struct Listinf { // pointers to the first and last node of the linked list
pStu head,tail;
} Inf,*pInf;
typedef struct {
Inf inf; // v_3.0 replace array of structure with a linked list
int sumstu; // sum of students in the class
int sumcrs; // sum of subjects in the exam
double crssco[SUBMAX+1];// sum of score of each course
double avercrs[SUBMAX+1];// average of each course
} Class,*pCls;
/* V 1.0 functions */
int Input (pCls p); //Input the information of the class, return 0 if success ,else return -1
void ScoreofCrs (pCls p); //Calculate total and average score of every course
void ScoreofStu (pCls p); //Calculate total and average score of every student
void SortbyDScore(pCls p); //Sort in descending order by total score of every student
void SortbyAScore(pCls p); //Sort in ascending order by total score of every stuednet
voi
文章浏览阅读115次。刚刚学会怎么弄的。。也不是很熟悉,O(∩_∩)O哈哈~。。总结下,web生成的图片的方式, 第一,使用servlet;返回图片到界面; 第二,生成图片到某个目录,界面引用图片路径 使用 JFreeChart 生成饼图(使用第二种):/** * 生成jFreeChart图片 * @param i -- 生成图片的名称 * @param arr -..._jfreechart 环形图 demo
文章浏览阅读7.3w次。在tesseract官方文档中,提供了一种直接使用vs编译的方法,不需要安装cppan以及sw打开这个链接,可以发现目前已经支持最新的tesseract4.1.1了使用git命令递归下载这个项目git clone --recursive https://github.com/peirick/Tesseract-OCR_for_Windows.git下载完成后使用vs打开tesseract.sln接下来利用vs进行编译,在编译的过程中会出现如下错误:\tesseract_4.1\src\c_libtesseract
文章浏览阅读2k次。linux下Mellanox 100G网卡刷固件一先从官网下载mlnx-en-4.7-1.0.0.1-rhel7.7-x86_64.tgz驱动https://note.youdao.com/yws/public/resource/bf31cff1232240b40106a9c8416ca5da/xmlnote/D02A782D61AF4F2E8B8892735AEEC3EA/606https://note.youdao.com/yws/public/resource/bf31cff1232240b40_mlnx 降固件版本
文章浏览阅读907次。python数据分析第3天numpy的应用import numpy as npimport pandas as pdimport matplotlib.pyplot as plt%config InlineBackend.figure_format = 'svg'array1 = np.array([42, 45, 62, 56, 35, 79, 67, 74, 30, 28, 54])array2 = np.array([65, 36, 123, 25, 45, 32, 26, 78, 5
文章浏览阅读1.3k次。nCode:DesignLife案例教程一 —— 简单S-N疲劳1.1 案例素材1.2 设计问题概述1.3 “5-Box trick”1.4 建立分析流程1.4.1 FE Input1.4.2 FE Display1.4.2.1 缩放1.4.2.2 旋转1.4.2.3 平移1.4.3 SN Analysis1.4.3.1 设置材料属性1.4.3.2 设置载荷1.5 运行流程1.6 添加Hot Spot Detection在本案例中,将使用应力-寿命(S-N)方法来计算恒定幅值载_ncode designlife 2021r1教程
文章浏览阅读388次。在实际的开发过程中,经常会遇到提取Excel文档中数据保存到数据库中的需求,PageOffice对此也提供了很好的解决方案。客户端在线打开Excel文件,保存的时候,PageOffice可以打包Excel文档中的指定单元格的数据或所有的数据提交到服务器端,在服务器端创建PageOffice的ExcelReader命名空间中的Workbook对象,就可以获取到Excel单元格中的值了。请参考Page..._pageoffice 读取word
文章浏览阅读2.6k次,点赞3次,收藏5次。#include<stdio.h>#include<math.h>int main(){ int n; double pi=acos(-1.0); scanf("%d",&n);//度数 printf("%f %f\n",sin(n/180.0*pi),cos(n/180.0*pi));//sin和cos内必须使用弧度制; ..._输入边及余弦求解代码
文章浏览阅读1.3w次。API_Level Platform_Version Version_Code NDK_Version 28 Android 9.0 Pie(馅饼) 27 Android 8.1 Oreo(奥利奥) 26 Android 8.0 Oreo(奥利奥) 25 Android 7.1 Noug..._android api 12 s是哪个单词
文章浏览阅读40次。正则表达式定义 正则表达式(regular expression)描述了一种字符串匹配的模式,可以用来检查一个串是否含有某种子串、将匹配的子串做替换或者从某个串中取出符合某个条件的子串等。 列目录时, dir *.txt或ls *.txt中的*.txt就不是一个正则表达式,因为这里*与正则式的*的含义是不同的。 正则表达式是由普通字符(例如字符 a 到 z)以及特殊字符(称为元字符)组...
文章浏览阅读4.1k次,点赞23次,收藏26次。路由器特点,网络IP地址规划网络间的特性,基本路由思想,编辑静态路由部分,查询设备整个路由表,查看特定的路由协议时使用,查询目的地址2.2.2.2的路由条目,IP路由表代码写法,IP路由表里的信息,路由表来源,路由表的信息,路由表选路规则,缺点:缺省路由,备份路由,等价路由,做实验的步骤......_等价路由和备份路由一样吗?
文章浏览阅读2.8k次。datastage 格式化 时间 日期
文章浏览阅读202次。51Nod-1085-背包问题 1085 背包问题在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数)。求背包能够容纳的最大价值。Input第1行,2个整数,N和W中间用空格隔开。N为物品的数量,W为背包的容量。(1 <= N <= 100,1 <= W <= 10