I'm a c++ newbie and have spent half a day googling this. Most posts seem vague or complex. And I have a feeling that there's a simpler way to do this. Any help is appreciated. A simple program that calculates tax based on the state entered by user:
#include <iostream>
int main()
{
std::cout << "Enter your order amount: ";
int amount{};
std::cin >> amount;
std::cout << "Which state do you reside in? ";
std::string state{};
std::cin >> state;
if (state == "WI") //THIS IS SIMILAR TO HOW I WOULD DO IT IN PYTHON | C++ doesn't work this way
std::cout << "Your tax is 5.0$" << std::endl;
std::cout << "Your total is " << amount + 5.0;
else
std::cout << "Your tax is 0.0$" << std::endl;
std::cout << "Your total is " << amount;
return 0;
}