#include "graphics.h"
#include "extgraph.h"
#include "genlib.h"
#include "simpio.h"
#include "random.h"
#include "strlib.h"
#include "conio.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <windows.h>
#include <olectl.h>
#include <stdio.h>
#include <mmsystem.h>
#include <wingdi.h>
#include <ole2.h>
#include <ocidl.h>
#include <winuser.h>
#include<math.h>
struct Data
{
char variable_name[10];
double value;
struct Data *Next_Data;
};
struct Point
{
double x;
double y;
struct Point *Next_Point;
};
typedef struct List
{
char list_name[10];
char color[30];
int ifBar;
int ifLine;
int ifPie;
struct Data *address;
struct List *Next_List;
struct Point *c;
}*LIST;
//将文件数据读入链表
/*List CreatList()
{
List head,end,p;
FILE *fp;
head=(List)malloc(sizeof(List));
p=head;
p->Next_List=NULL;
fp=fopen("test.txt","r");
while(!feof(fp))
{
end=(List)malloc(sizeof(List));
p->Next_List=end;
p=end;
p->Next_List=NULL;
fscanf("%s %lf",p->address->variable_name,p->address->value);
}
fclose(fp);
return head;
}*/
//文件保存
void CreatFile(LIST p)
{
FILE *fp;LIST q=p;
fp=fopen("NewFile.txt","wb");
if(fp!=NULL)
{
while(q)
{
fprintf(fp,"%s %s %d %d %d",q->list_name,q->color,q->ifBar,q->ifLine,q->ifPie);
while(q->c)
{
fprintf(fp,"%lf %lf",q->c->x,q->c->y);
q->c=q->c->Next_Point;
}
}
}
fclose(fp);
}
//文件
List OpenFile(FILE *fp)
{
List head,end,p;
head=(List)malloc(sizeof(List));
p=head;
p->Next_List=NULL;
return head;
}
void Main()
{
List p;
if(/*新建*/)
{
p=CreatList();
}
}
利用给定的libgraphics库制作一个简易的数据可视化小程序,如何实现将绘制好的图表通过文件保存,对统计图表修改后将数据更新至文件。