2018年7月23日 星期一

itsa [C_AR111-易]對話機器人

#include<iostream>
#include<string>
using namespace std;

int main()
{
int n = 0;
string s;
string say[5] = { "Sorry","Hi","Hello","How do you do","How are you" };
while (getline(cin, s))
{
if (s == "Hi" || s == "Hello" || s == "How do you do" || s == "How are you")
{
n++;
cout << say[n] << endl;
if (n == 4)
n = 0;
}
else
{
n = 0;
cout << say[0] << endl;
}
}
return 0;
}

沒有留言:

張貼留言