Please support our C++ advertiser: Programming Forums
![]() |
•
•
Join Date: May 2008
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
Hi There,
I'm learning C++. One of the questions requires a function to do a calculation below. I have no clue how to do this. Can anybody help?
I'm learning C++. One of the questions requires a function to do a calculation below. I have no clue how to do this. Can anybody help?
•
•
•
•
WeTryToHelp gives bursaries to help students with buying their textbooks. The amount of money depends on how
many modules the student passed during 2007 and for how many modules the student is registered in 2008. It works
as follows:
• if the student did not pass any modules in 2007: no bursary,
• if the student passed 1 or 2 modules in 2007 and is registered for at least 1 module in 2008: R300,
• otherwise: the bursary is equal to (number of modules passed + number of modules registered) * 100.
Three examples: If the student passed 4 modules in 2007 and is registered for 5 modules in 2008, the bursary will be
R900. If the student passed 2 modules in 2007 and is registered for 5 modules in 2008, the bursary will be R300. If
the student did not pass any modules in 2007 and is registered for 5 modules in 2008, no bursary will be given.
•
•
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,895
Reputation:
Rep Power: 12
Solved Threads: 203
This is not a free homework service. You'll have to show some effort before you get help. So post what you've done so far.
Or ask specific questions
Or ask specific questions
Last edited by niek_e : May 29th, 2008 at 4:34 am.
Want better/more replies to your questions? Wrap your code in [code] [/code] tags!
do NOT pm me for help, in the best case, you'll get ignored
do NOT pm me for help, in the best case, you'll get ignored
•
•
Join Date: May 2008
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
Fair enough. Here is the code
cplusplus Syntax (Toggle Plain Text)
#include <iostream> using namespace std; //modP is the passed modules and modR is registered modules float bursary(float modP, float modR) { float burs; {if (modP == 0) burs = 0; else if (modP == 1 && modR >= 1) burs = (modP * 300); else burs = ((modP + modR)*100); } return burs; }
Last edited by Narue : May 29th, 2008 at 12:14 pm. Reason: Changed quote to code tags
![]() |
Similar Threads
Other Threads in the C++ Forum
- What is google current algorithm? (Search Engine Optimization)
- Project topics (Java)
- calculations with random #'s (C++)
- Tutorial Help =( (C++)
- Am i doing something wrong? (C++)
- Need some help with n00b code project (C++)
- where did AI reached Now? (Computer Science)
- Help with crypto program (C#)
- subset sum (C++)
Other Threads in the C++ Forum
- Previous Thread: post and prefix operators
- Next Thread: undefined reference
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode