Go to Post Its always good to read the rules yourself rather than listen to "word of mouth" rules. - Killraine [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-01-2009, 19:40
Richard McClellan's Avatar
Richard McClellan Richard McClellan is offline
Engineering Mentor
FRC #0254 (Cheesy Poofs)
Team Role: Mentor
 
Join Date: May 2004
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 322
Richard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud of
Send a message via AIM to Richard McClellan
Re: C++ Program to Determine Cost Per Student for Regional

import <math.h>
use ceil (advisor)
to round up
__________________
~ Richard McClellan ~
Former Student on 1477 | Northside Roboteers | 2004-2005
Former Lead Mentor for 2158 | ausTIN CANs | 2007-2010
Current Mentor for 254 | Cheesy Poofs | 2013
  #2   Spotlight this post!  
Unread 10-01-2009, 19:52
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
Re: C++ Program to Determine Cost Per Student for Regional

Quote:
Originally Posted by Richard McClellan View Post
import <math.h>
use ceil (advisor)
to round up
Hmm I tried all of those things

Quote:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <math.h>
using namespace std;

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 = ceil( (boys + girls)/10 ) ;
cout << advisors << endl;

///////////////////////////////////////////////////////////////////////


float room ;
room = ceil(boys/4) + ceil(girls/4) + ceil(advisors/4) ;
cout << "Rooms nedeed:" << room << endl ;
but for some reason its not rounding up
  #3   Spotlight this post!  
Unread 10-01-2009, 20:22
kevin.li.rit's Avatar
kevin.li.rit kevin.li.rit is offline
Imaginary Friend
AKA: Kevin Li
FRC #0596 (SciClones)
Team Role: Student
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Hopkinton, Massachusetts
Posts: 936
kevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond reputekevin.li.rit has a reputation beyond repute
Send a message via Yahoo to kevin.li.rit
Re: C++ Program to Determine Cost Per Student for Regional

I think it's because boys and girls are integers and it is doing integer division. It already drops the decimal before ceil can round it up. Either declare boys and girls as floats or convert them within the ceil function.
__________________
Kevin Li

596 - Sciclones
1405 - Finney Falcons
2262 - Holliston Panthers

Last edited by kevin.li.rit : 10-01-2009 at 20:26. Reason: spelling.
Closed Thread


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