1 Replies - 134 Views - Last Post: 26 May 2019 - 07:50 AM Rate Topic: -----

#1 Deadweight77   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 04-May 19

Using greater than, less than,subtraction,ect. on strings

Posted 26 May 2019 - 07:43 AM

Is it possible to to use operators such as greater than, less than,subtraction,ect. on strings? I've been working on a program for banking and would like to know. I've been using string because when using string it reads both the dollars and cents whereas int only reads the dollars. For example when putting in $25.75 to an account string reads it in full, but int only reads $25.
Is This A Good Question/Topic? 0
  • +

Replies To: Using greater than, less than,subtraction,ect. on strings

#2 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 6929
  • View blog
  • Posts: 23,546
  • Joined: 05-May 12

Re: Using greater than, less than,subtraction,ect. on strings

Posted 26 May 2019 - 07:50 AM

Do not be stringly typed. Get the input as a string, and then parse the string to into a integer count of pennies (highly recommended), or a floating point number (not recommended for money).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1