Go to Post Teams that TRY to win and TRY to do their best end up having students that learn more, learn the value of hard work, and are inspired by the process. - Chris Hibner [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 10-01-2009, 19:34
neoshaakti's Avatar
neoshaakti neoshaakti is offline
Registered User
FRC #2554 (WarHawks)
Team Role: College Student
 
Join Date: Jul 2007
Rookie Year: 2008
Location: Edison, NJ
Posts: 207
neoshaakti is a splendid one to beholdneoshaakti is a splendid one to beholdneoshaakti is a splendid one to beholdneoshaakti is a splendid one to beholdneoshaakti is a splendid one to beholdneoshaakti is a splendid one to beholdneoshaakti is a splendid one to behold
Send a message via AIM to neoshaakti
C++ Program to Determine Cost Per Student for Regional

I'm writing a C++ program in Dev C++ to determine how much a trip would cost for each member of the team; however, I'm running into trouble since calculate values keep rounding down. If there are 5 people, and 1 room can hold 4 people, the program tells me I need 1 room (which is wrong).

How do I get rounded up values for "girls, boys, advisors"

Quote:
int main(int argc, char* argv[])
{
cout << "Enter number of boys, then Enter Number of Girls" << endl;
int boys ;
int girls;
cin >> boys ;
cin >> girls;
cout << "Number of Advisors needed:" << endl;
int advisors;
advisors = (boys + girls)/10 ;
cout << advisors << endl;

/////////////////////////////////////////////////////////////////////// pretty simple all Im doing here is figuring out how many advisors I need b/c our school has a policy that the ratio of students to teachers has to be 10:1


float room ;
room = ceil(boys/4) + ceil(girls/4) + ceil(advisors/4) ; // want to round each number individually because boys can only room with boys, girls with girls and advisors with advsiors (so they prefer )
cout << "Rooms nedeed:" << room << endl ;
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any Teams in NJ want to Split the cost for a field, setup practices?!? nHouse General Forum 28 04-02-2009 22:23
For FRC Student Machinists Dasistmeinmoped General Forum 25 15-01-2008 12:13
Cost Accounting for 2005 breaker panel Peter Matteson Rules/Strategy 0 24-01-2006 14:01
A hard decision for a college student Elyse Holguin Chit-Chat 7 15-09-2004 19:37
how would U determine the exact speed of your robot? HolyMasamune General Forum 4 29-01-2003 09:44


All times are GMT -5. The time now is 00:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi