I'm trying to write a program that asks the user to enter one
of four different types of foods (Salty = s, Sweet = w, Protein = p & Carbohydrate = c).
Depending on the letter entered, I would like for my program to respond with a
sentence about that food type. If the user input is something other that the four letters,
my program should print "I'm sorry, I do not recognize your selection."
I also would like to allow the user input to be either in upper or lower case.
Here is what I have so far.
The program builds but it prints out these response for the letter entered as well as the "I'm sorry" message.
PLEASE HELP
*/
#include <iostream>
using namespace std;
int main()
{
char answer = 's' || 'w' || 'p' || 'c' || 'S' || 'W' || 'P' || 'C';
cout << "What type of food is it? (Enter a letter): ";
cout << "alty S[W]eet [P]rotein [C]arbohydrate " <<endl;
cin >> answer;
do
{
if (answer != 's' || 'w' || 'p' || 'c' || 'S' || 'W' || 'P' || 'C');
{
cout << "I'm sorry, I do not recognize your selection. Please try again." <<endl; break;
}
}
while (true);
{
answer == 's' || 'S';
{
cout << "Be careful! Too much salt can raise your blood pressure." <<endl;
}
answer == 'w' || 'W';
{
cout << "Too many sweets can increase your body fat and your blood sugar levels." <<endl;
}
answer == 'p' || 'P';
{
cout << "Protein is an important and neccessary macro nutrient." <<endl;
}
answer == 'c' || 'C';
{
cout << "Carbohydrate is important, but most people eat too much of it." <<endl;
}
}
}