📄 chat.h
字号:
// Program Name: chatterbot1
// Description: this is a very basic example of a chatterbot program
//
// Author: Gonzales Cenelia
//
#include <iostream>
#include <string>
#include <ctime>
int main()
{
std::string Response[] = {
"I HEARD YOU!",
"SO,YOU ARE TALKING TO ME.",
"CONTINUE,I'M LISTENING.",
"VERY INTERESTING CONVERSATION.",
"TELL ME MORE..."
};
srand((unsigned) time(NULL));
std::string sInput = "";
std::string sResponse = "";
while(1) {
std::cout << ">";
std::getline(std::cin, sInput);
int nSelection = rand() % 5;
sResponse = Response[nSelection];
if(sInput == "bye") {
std::cout << "IT WAS NICE TALKING TO YOU USER, SEE YOU NEXT TIME!" << std::endl;
break;
}
std::cout << sResponse << std::endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -