• Advertisement
Sign in to follow this  

Help using modulus operator and Integer Arithmetic "the \"

This topic is 3843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a programming example in my VB.Net 2003 book that I am trying to complete, and am a little stumped on how to solve it. Here is the description: "Write a program that will display the number of dollars and cents in two output TextBox controls based on user numeric input. For instance, if the user inputs 543, the program will display 5 in the dollars output TextBox control and 43 in the Cents output TextBox control. For this program, use integer arithmetic and avoid decimal variable and values. If necessary, review the integer remainder modular operator, Mod, introduced in this chapter." Now, I know how to get the nud value. Question is, how do I use integer arithmetic and mod operator to divide the value into dollars and cents? Any help appreciated, Shawn Edit - This is from Chapter 4 of an introduction to VB.Net book. Not much has been covered other than getting values from things (like the NUD), setting text values and such, and variables. Have covered a Format$ function, not sure if that applies to this program, just thought I would mention that function.

Share this post


Link to post
Share on other sites
Advertisement
dollars_to_display = amt_entered integer division 100
cents_to_display = amt_entered mod 100


I don't know VB so I can't tell you how they are represented in that language. But if they tell you what the modulus operator is then that is how you apply it to get the answer you seek.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement