im currently trying to make little recipe app. I have made a string array with 10 strings and 10 bools. When I for example type Cinnemon I want to make the _Cinnemon true. How do I do that? Also is this written correctly, or could I make it better im quite new to programming. Lastly how can I fix it so it dosent have anything to say wheter its small letters or big.
Heres the code:
std::cout << "Welcome, type your ingredients " << std::endl;
std::string ingredients[10]{"Cinnemon", "Milk", "Eggs", "Butter", "Tomatoes", "Salt", "Backing Soda", "Suggar", "Chicken", "Honny"};
bool _cinnemon, _milk, _eggs, _butter, _tomatoes, _salt, _backingSoda, _Suggar, _chicken, _honny;
std::string ingredient;
int i = -1;
while (i = -1) {
std::cin >> ingredient;
i++;
while (i < 9)
{
if (ingredient == ingredients[i]){
std::cout << "Type another if you have any more igredients else type Exit" << std::endl;
i++;
} if (ingredient == "Exit" || "exit"){
return 0;
} else{
i++;
}
}
}
Thnks in advance, sorry for the bad english my mother thoung is Norwegian
Aucun commentaire:
Enregistrer un commentaire