I am currently learning c++ and creating an assistant for myself. I need to make sure the if command checks for a sentence, not a word in a string how do I do that.
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
const string YES = "yes";
const string NO = "no";
//ignore this
int main () {
std::string Question;
std::string check;
std::cout << ("Hi sir how may i assist you?\n");
//user asks the question and then a if command checks the question from a list of questions and if the line is the same as in the database it gives a output
getline (cin, Question);
if (Question == "whats the weather?") {
std::cout << ("Well it is...\n");
//then it pulls data from the web and puts it in here
}
}
Output
Hi sir how may I assist you?
whats the weather
(nothing) else happens