int main() { ListLink head,temp = NULL; int inum; head = CreateLink(); PrintLink(head); temp = (ListLink)malloc(LEN); printf("student's num:"); scanf("%d",&temp->num); printf("student's name:"); scanf("%s",temp->name); printf("student's score:"); scanf("%lf",&temp->score); head = InsertNode(head,temp,numMin); PrintLink(head); printf("the inum of student to search:"); scanf("%d",&inum); temp = Searchid(inum,head); if(temp) printf("temp num:%d\tname:%s\tscore:%.2lf\n",temp->num,temp->name,temp->score); printf("Please input the num of student to delete:"); scanf("%d",&inum); head = DeleteNode(head,inum); PrintLink(head); head = SortScore(head); PrintLink(head); head = Sortid(head); PrintLink(head); head = DeleteLink(head); return 0; }
void CRacingFrame::CoreFrame() { while(1){ system("CLS"); IntroScreen(); cout<<"Input your choice:"; int choice; cin>>choice; switch (choice) { case 1: { if(PlayerCar!=NULL) delete PlayerCar; PlayerCar=NULL; RunGame(); system("CLS"); char yes_no=' '; while(yes_no!='y'&&yes_no!='n'){ fflush(stdin); cout<<"Do you want to save your record?(y/n):"; cin>>yes_no; } if(yes_no=='y') { LoadRecord(); string _Name; fflush(stdin); cout<<"Input your name:"; getline(cin,_Name); CPlayer record_after_play(_Name,PlayerCar->getCarType(),Point); Player_Record.push_back(record_after_play); SortScore(); SaveRecord(); } if(yes_no=='n') { fflush(stdin); Sleep(500); } break; } case 2: { CMapRacing::SetColor(2); LoadRecord(); ShowRecord(); CMapRacing::SetColor(0); break; } case 3: { CMapRacing::SetColor(3); CustomCar(); CMapRacing::SetColor(0); break; } case 4: break; default: { cout<<"Oopp! You got a wrong choice!"; Sleep(500); break; } } if(choice==4) { system("CLS"); cout<<"You was out of game"; Sleep(500); break; } } }