91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

C++實(shí)現(xiàn)數(shù)據(jù)庫(kù)DBMS建表插入刪除屬性功能

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
#define?MAXSIZE?60
using?namespace?std;

/*鏈表每一個(gè)節(jié)點(diǎn)為table的每個(gè)屬性*/
struct?Property?????????????????//鏈表結(jié)點(diǎn)即表的屬性
{
????char?property[20];???????????????????????//屬性名
????char?type[20];???????????????????????????//類型
????char???size[20];?????????????????????????//屬性分配的空間
????char??Constraint[40];????????????????????//完整性約束
????struct?Property?*next;???????????????????//下一結(jié)點(diǎn)指針
};
struct?Table?????????????????????????????????//table結(jié)構(gòu)體
{
????struct?Property?*head;???????????????????//鏈表頭指針
????int?number;??????????????????????????????//鏈表結(jié)點(diǎn)數(shù)
????char?TableName[20];??????????????????????//表名
????struct?Table?*next;
};

struct?Schema????????????????????????????????//模式
{
????struct?Table?*head;??????????????????????//模式頭指針
????int?number;??????????????????????????????//模式中表的數(shù)量
????char?SchemaName[20];?????????????????????//模式名字
};



/*初始化結(jié)構(gòu)體*/
void?InitSchema?(struct?Schema?&schema)
{
????schema.head?=?NULL;
????schema.number?=?0;
}
void?InitTable?(struct?Table?&table)
{
????table.head?=?NULL;
????table.number?=?0;
}

/*將建表第一行命令中的表名分離出來(lái),保存在TableName中*/
void?DepartTable(char?*CreateTable?char?*TableName)
{
????while(*CreateTable!=‘\0‘)
????????CreateTable++;
????while(*CreateTable?!=?‘?‘)
????????CreateTable--;
????CreateTable++;

????while(*CreateTable!=‘\0‘)
????{
????????*TableName?=?*CreateTable;
????????*CreateTable?=?‘\0‘;
????????CreateTable++;
????????TableName++;
????}
????*TableName?=?‘\0‘;

}
/*刪除輸入屬性每一行的首尾空格*/
void?Delete_Start_End_Blank(char?*Member)
{
????/*去除首部空格*/
????char?temp_1[MAXSIZE]?*p?=?Member;
????while(*p?==?‘?‘)
????????p?++;
????int?j?=?0;
????while(*p?!=?‘\0‘)
????{
????????temp_1[j]?=?*p;
????????j++;
????????p?++;
????}
????temp_1[j]?=?‘\0‘;
????strcpy(Member?temp_1);
????/*去除尾部空格*/
????char?temp_2[MAXSIZE]?*p_1?=?Member?*p_2?=?Member;
????while(*p_1?!=?‘\0‘)
????????p_1?++;
????p_1?--;
????while(*p_1?==?‘?‘)
????????p_1?--;
????p_1++;
????int?i?=?0;
????while(p_2?!=?p_1)
????{
????????temp_2[i]?=?*p_2;
????????i++;
????????p_2?++;

????}
????temp_2[i]?=?‘\0‘;
????strcpy(Member?temp_2);
}
/*建表第一行命令去掉空格并全部轉(zhuǎn)換為小寫,例如:create?table?stu->createtablestu*/
void?DeleteBlankAndChange(char?*CreateTable)
{
????char?temp[MAXSIZE];
????int?j?=?0;
????for(int?i?=?0;?i?????{
????????if(CreateTable[i]?!=?‘?‘)
????????{
????????????temp[j]?=?CreateTable[i];
????????????if(temp[j]>=65?&&?temp[j]<=90)
????????????????temp[j]?=?temp[j]?+?32;
????????????j++;
????????}
????}
????temp[j]?=?‘\0‘;
????strcpy(CreateTable?temp);
}
/*將每一屬性輸入行分為:propertytypesizeConstraint*/
void?DepartProperty(struct?Property?*Pro?char?Member[])
{
????char?*temp_1;????????????????//保存去掉部分空格后的字符串
????temp_1?=?(char?*)malloc(MAXSIZE?*?sizeof(char));
????char?*temp_2;????????????????//保存‘(‘前去掉空格后的字符串
????temp_2?=?(char?*

評(píng)論

共有 條評(píng)論