Working on a project and stumbled here for help. I am at about 90% of what I need but I am having one small problem. With the exception of one of my "if" sections, my "else" output is triggered and diplayed when I don't want it to be. Just asking what I need to do so it only shows up if the user enters a wrong input. Basically, the "Next time.." line shows up even if I input the correct "fruit"
Thanks and tell me if I am posting this wrong too.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string fruit, ftype, Apples, Oranges, Pears;
cout<<"Apples, Oranges or Pears?"<<endl;
cin>>fruit;
cin.ignore();
if (fruit=="Apples")
{
cout<<"Golden Delicious, Granny Smith, or McIntosh?"<<endl;
cin>>ftype;
cin.ignore();
}
if (fruit=="Oranges")
{
cout<<"Valencia, Blood or Navel?"<<endl;
cin>>ftype;
cin.ignore();
}
if (fruit=="Pears")
{
cout<<"Bartlett, Bosc or Comice?"<<endl;
cin>>ftype;
cin.ignore();
}
else
cout<<"Next time please enter one of the fruits requested!"<<endl;
cout<<"You have selected "<<ftype<<" "<<fruit<<endl;
}