📄 main.cpp
字号:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "OrderSet.h"
OrderedSet Set1,Set2,Set3;
void Initialization()
{
int i;
for (i=0;i<80;i++) printf("*");
printf("\n Makesetl-1 Makeset2-2 Union-u Intersection-i Difference-d Quit-q \n");
for (i=0;i<80;i++) printf("*");
printf("please choose the operation:");
}
void Interpret (char cmd)
{char v[100];
switch (cmd)
{ case '1':printf("please input set1:");
scanf("%s",v);
CreateSet(Set1,v);
printf("Set1=:");
PrintSet(Set1);
printf("\n");
break;
case '2':printf("please input set2:");
scanf("%s",v);
CreateSet(Set2,v);
printf("Set2=:");
PrintSet(Set2);
printf("\n");
break;
case 'u':
case 'U': Union(Set3,Set1,Set2);
printf("the union of the Set1 and Set2 :");
PrintSet(Set3);
DestroyList(Set3);
printf("\n");
break;
case 'i':
case 'I': Intersection(Set3,Set1,Set2);
printf("the Intersaction of the Set1 and Set2 :");
PrintSet(Set3);
DestroyList(Set3);
printf("\n");
break;
case 'd':
case 'D': Difference(Set3,Set1,Set2);
printf("the Difference of the Set1 and Set2 :");
PrintSet(Set3);
printf("\n");
DestroyList(Set3);
}
}
main ()
{Initialization();
char cmd;
do {cmd=getchar();
Interpret(cmd);}
while (cmd!='q' && cmd !='Q');
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -