How to get the last 2 digits turned into a decimal

I'm trying to make a program that counts change. So I ask someone how much they paid. If they enter 1234 how can I make it so the last 2 digits are counted as a decimal so it'd be 12.34?

1
2
3
4
  float cashGiven;

  cout << "You gave: $";
  cin >> cashGiven;
You can use a string variable for that?

eg:
1
2
string num=2345;
num.insert(num.length()-2,".");


Aceix.
Topic archived. No new replies allowed.