Comparing Input Question

I'm writing some basic code for a Sales Tax Calculator to help me learn more about C++. I have it completed, but I'm trying to add more features and things into the application so as to help me learn more code.
At one point, the user is asked to submit the tax percentage in decimal form (i.e '.13'). I was wondering how I could allow the user to submit a decimal or a percentage (i.e '.13' or '13%') while still yielding the same answer. How would I compare what the user inputs to insure that the number ends up being in decimal form regardless of what form the user inputs? (Possibly by an if else statement)

Please ask for any clarification if needed, I'm not great at explaining things.

Thanks in advance,

Andy.
You can analyze if the input contains % symbol.
Yeah I figured as much. I was really wondering what the code for that would look like.
1
2
3
4
5
6
7
8
9
string s;

getline(cin, s);

if (s.find('%') != string::npos){//it contains %
 //convert string to number and divide by 100.0
}
else
// convert string to number 
Thanks!
Topic archived. No new replies allowed.