数据结构上机实验报告-二叉树(10)
时间:2025-04-20
时间:2025-04-20
int i; char temp; pTreeT root = NULL; srand( (unsigned)time( NULL ) );
printf("请输入元素:\nA.自动生成.\nB.手动输入.\n"); do{ temp=getchar(); } while(!(temp=='A'||temp=='a'||temp=='B'||temp=='b')); if((temp)=='A'||(temp)=='a'){ for (i=0; i<MAX_CNT; i++) { BT_Insert(rand() % BASE, &root); } } else if((temp)=='B'||(temp)=='b'){
printf("请输入元素,元素以#结尾\n");
while((temp=getchar())!='#') BT_Insert(temp, &root); }