Hello all,
I'm new here and am pretty much a rookie programmer. I'm working on a home project that saves recipes and will eventually sort them. I need help with the cin command on multiple variables. Here is my code:
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
char name, category, group, style, prep, ingred, instruct, notes;
//Recipe information questions:
cout<<"Recipe name? \n ";
cin>> name;
cin.ignore();
cout<<"Category? \n";
cin>> category;
cout<<"Food Group? \n";
cin>> group;
cin.ignore();
cout<<"Food Style? \n";
cin>> style;
cin.ignore();
cout<<"Prep Time? \n\n";
cin>> prep;
cin.ignore();
cout<<"Recipe Ingredients? \n\n";
cin>> ingred;
cin.ignore();
cout<<"Cooking Instructions? \n\n";
cin>> instruct;
cin.ignore();
cout<<"Serving Notes? \n\n";
cin>> notes;
cin.ignore();
}
I attached a picture of what happens after I run it. After I type in Chicken Parm and hit enter it wont let me enter the other variables. Do I need to use strings? Help!
Thanks,
Tony