Hey Guys,
Can you help me understand this concept? I am trying to use function
qualityPoints here to return a value of 4 if an average is 90-100, 3 if it
is 80-90, 2 if its 70-80, 1 if its 60-70 and 0 if it drops below 60. I am
learning functions and trying to figure out what values should be between
the parentheses in the initializing phase, and also how it should be
written. I am on a mental block on this one. Here's what I have so far:
//Program returns the GPA based on student average
include <iostream>
include <cmath>
using std::cout;
using std::cin;
using std::end1;
int qualityPoints ( int, int, int, int, int, int )
int main() //function main begins program execution
{
int average; //student average
int GPA; //grade point average
cout << "Enter the student's average:";
cin >> average;
cout << "Grade Point Average Is:";
<< qualityPoints ( GPA ) << end1;
getch (); //indicates successful termination
}
//function qualityPoints definition
int qualityPoints (
Thanks for your help! 4 2080
Keith wrote: Can you help me understand this concept? I am trying to use function qualityPoints here to return a value of 4 if an average is 90-100, 3 if it is 80-90, 2 if its 70-80, 1 if its 60-70 and 0 if it drops below 60. I am learning functions and trying to figure out what values should be between the parentheses in the initializing phase, and also how it should be written. I am on a mental block on this one. Here's what I have so far: //Program returns the GPA based on student average
[..nothing of substance..]
We don't do homeworks. However, here is a hint: given a value of the
average, compare it to 90, if it's greater or equal, return 4, if not,
compare it to 80, and so on.
V
Yeah, I'm not looking for someone to do it, just help me appreciate the
concept of functions, I can't get how they should be laid out.
Keith wrote: Yeah, I'm not looking for someone to do it, just help me appreciate the concept of functions, I can't get how they should be laid out.
You'll find as many opinions about that as you'll hear voices. What
does the C++ book you're using to study, says?
Keith wrote: Hey Guys,
[snip requirements] //Program returns the GPA based on student average
include <iostream>
include <cmath>
using std::cout;
using std::cin;
using std::end1;
int qualityPoints ( int, int, int, int, int, int )
Why do you have so many parameters here to be sent to qualityPoints ?
Right now you are provinding 6 ints. This is same as 6 input values.
But, as far as I understood your problem you just need to give as input
the average which you have already asked the user. Soo, to start with
you just need to give 1 input or only 1 int so your above line should
be:
int qualityPoints (int);
Now let us know how would you do this in real life if say your next
door neighbor tells you that he has got 76 as average. Another neighbor
tells you she got 85. You would simply have the table in front of you
and tell him/her their Gade Point Average.
Try it yourself and ask as many questions as you want but give it a
shot.
int main() //function main begins program execution
{
int average; //student average
int GPA; //grade point average
cout << "Enter the student's average:";
cin >> average;
cout << "Grade Point Average Is:";
<< qualityPoints ( GPA ) << end1;
getch (); //indicates successful termination
}
//function qualityPoints definition
int qualityPoints (
Thanks for your help! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Daniel |
last post by:
Hello =)
I have an object which contains a method that should execute every x ms. I
can use setInterval inside the object construct like this -
self.setInterval('ObjectName.methodName()',...
|
by: Mike |
last post by:
When trying to compile (using Visual Web Developer 2005 Express Beta;
frameworkv2.0.50215 ) the source code below I get errors (listed below due to
the use of ICallBackEventHandler. Ultimately I...
|
by: Random Person |
last post by:
Does anyone know how to use VBA to relink tables between two MS Access
databases? We have two databases, one with VBA code and the other with
data tables. The tables are referenced by linked...
|
by: Grasshopper |
last post by:
Hi,
I am automating Access reports to PDF using PDF Writer 6.0. I've
created a DTS package to run the reports and schedule a job to run this
DTS package. If I PC Anywhere into the server on...
|
by: Daveyk0 |
last post by:
Hello there,
I have a front end database that I have recently made very many changes
to to allow off-line use. I keep copies of the databases on my hard
drive and link to them rather than the...
|
by: Rob |
last post by:
Hi all,
I am having trouble converting the code below (found on
http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a
format that will work using vb .NET.
Can anyone have a look...
|
by: Ron |
last post by:
Hello,
Is it required to use
Imports System.Runtime.InteropServices
to run C++ API code? I ask because I thought I read
somewhere that this was required. If it is not required
would it...
|
by: B Williams |
last post by:
I am stuck on an assignment that uses classes and functions. I am receiving
numerous errors when I try to run a test program to see if I wrote it
correctly. Can someone please point me in the right...
|
by: Tugrul HELVACI |
last post by:
I'm using Delphi 2006 and I have a class defination like this:
TPerson = class
fPersonName : String;
fPersonSurName : String;
fPersonAge : Integer;
published
property PersonName : String...
|
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= |
last post by:
Greetings! I was researching AJAX to provide a solution to displaying status
messages while a long process executed. I found several examples online and
was able to use their code to get a quick...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |