×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

% modular Problem. Can someone help?

% modular Problem. Can someone help?

% modular Problem. Can someone help?

(OP)
I am having so trouble with % modular in one of my excercise. The problem starts with a wholesale company who will only ship case of 12 items, or master case of 144 items. That means if someone ordered one item, he will get one case of 12.
Inputs:
1. Number of items order 200
2. Case Size 12
4. Master Case Size 144
5. Cost per case 1.5

Outputs:
1. Number of items order 200
2. Case size 12
3. Master case size 144
4. Cost per items $ 1.5
5. Number of case shipped 5
6. Number of master case 1
7. Number of items shipped 204
8. Total cost of shippment 306.00

Here are some of my problem:#include <iostream.h>

int main()

{
int Case, Mcase, num1, num2, items, total;
Case = 12;
Mcase = 12;

num1 = items%Case;
num2 = items%Mcase;

if (num1 > 1)
num1 = +1;
else num1 = 0;





cout << " Enter number of items you want to order: " <<endl;
cin >> items;

Case = (items/Case) + num1 ;
cout << "number of case ordered " <<Case <<endl;
Mcase = (items/Mcase) + num2;
cout << "number of master case ordered " <<Mcase <<endl;



}

RE: % modular Problem. Can someone help?

the mod will only return the remained. If you want to calculate thwe whole and the remaineder you need to do this


quotient = num / input
remainder = num % input

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close