Updated: When I Enter 1 it shows, How are you? and then directly bye skipping the the second if statement and directly goes to else. While after displaying how are you it should get the input from user and and the respond according to the if else statement. In this code I tried to use getline() for getting full sentence as input from user and show results. It's a very basic program. I was trying to make small interactive platform.
#include <iostream>
#include <string>
using namespace std;
int main()
{
int a;
string b;
string b1 = "I am fine";
std::cout << "Hello, Enter 1 to continue...." << std::endl;
std::cin >> a;
if(a==1){
std::cout << "How are you?" << std::endl;
getline(std:: cin, b);
}else{
cout<<endl;
}
int c;
if(b == b1){
std::cout << "Gald to know that, press 2 to continue..." << std::endl;
cin>>c;
}else{
std::cout<< "Bye" <<endl;
}
return 0;
}