if (rate == 1 || rate == 2) {
cout << "Ooh. That's too bad. Can you give us some feedback that could help this program?\nAnswer: ";
cin >> feedback;
cout << "Thank you so much!\n";
}
elseif (rate == 3 || rate == 4 || rate == 5) {
cout << "Wow! That's great. Can you give us some feedback that could help this program?\nAnswer: ";
cin >> feedback;
cout << "Thank you so much!\n";
}
elseif (rate > 5) {
cout << "Oh! You're too kind! Can you give us some feedback that could help this program?\nAnswer: ";
cin >> feedback;
cout << "Thank you so much!\n";
}
#include <iostream>
#include <string>
const std::string prompt = "Can you give us some feedback that could help this program?\nAnswer: ";
const std::string specifics[]{{"Ooh. That's too bad. "}, {"Wow! That's great. "}, {"Oh! You're too kind! "}};
int main()
{
int rate{};
std::cout << "Enter rate \n";
std::cin >> rate;//usual input validation checks, etc
if (rate <= 2)
{
std::cout << specifics[0] + prompt;
}
elseif (rate <= 5)
{
std::cout << specifics[1] + prompt;
}
elseif (rate > 5)
{
std::cout << specifics [2] + prompt;
}//could have a default option to catch incorrect entries and a loop to run until correct entry
int feedback{};
std::cin >> feedback;
std::cout << "Thank you so much!\n";
}