Exemple #1
0
void commandTeach(){
	char tmp1[1000],tmp2[1000],tmp3[1000];
	chatRecord.add("Renge: 喵?要教我些什么……?\n");
	cin.getline(tmp1,1000,'\n');
	while(strlen(tmp1)==0){
		chatRecord.output();
		cin.getline(tmp1,1000,'\n');
	}
	sprintf(tmp3,"Renge: “%s”么……?我该怎么回答?\n",tmp1);
	chatRecord.add(tmp3);
	cin.getline(tmp2,1000,'\n');
	while(strlen(tmp2)==0){
		chatRecord.output();
		cin.getline(tmp2,1000,'\n');
	}
	sprintf(tmp3,"Renge: “%s”……我记住了……\n",tmp2);
	chatRecord.add(tmp3);
	answers.teach(tmp1,tmp2);
}
Exemple #2
0
void process(){
	char tmp[1000];
    cin.getline(tmp,1000,'\n');
	if(strlen(tmp)==0){
		chatRecord.output();
		return;
	}
	if(tmp[0]!='/'){
		char tmp2[1000];
        sprintf(tmp2,"%s: %s\n",user.name,tmp);
        chatRecord.add(tmp2);
        answers.answer(tmp,chatRecord);
    }else if(strhead(tmp,"/exit ")||strcmp(tmp,"/exit")==0) commandExit();
	else if(strhead(tmp,"/clear ")||strcmp(tmp,"/clear")==0) commandClear();
	else if(strhead(tmp,"/teach ")||strcmp(tmp,"/teach")==0) commandTeach();
    else if(strhead(tmp,"/help ")||strcmp(tmp,"/help")==0) commandHelp();
	else commandNotFound();
}