473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Call Functions

#include <iostream>

void Lab11identification()
{

}

int getNumericGrade (int gradeIn) {



do {

if (gradeIn > 100 || gradeIn < 0 && gradeIn != -1)
cout << "Number out of range. Try again." << endl;
else cout<<"Your letter grade is: "<< getLetterGrade (gradeIn)<<endl;

cout << "Enter a numeric grade (0-100, -1 to stop): ";
cin >> gradeIn;

} while (gradeIn != -1);
if (gradeIn == -1)
cout<<"Good-Bye";


return gradeIn;
}


char getLetterGrade (int gradeIn) {
char Lgrade;
if (gradeIn <= 100 && gradeIn >=90)
Lgrade='A';
if (gradeIn <90 && gradeIn >=80)
Lgrade='B';
if (gradeIn <80 && gradeIn >=70)
Lgrade='C';
if (gradeIn <70 && gradeIn>=60)
Lgrade='D';
if (gradeIn <60 && gradeIn>0)
Lgrade='F';
cout<<Lgrade;
return Lgrade;
} // getLetterGrade


int main() {
char answer;
int gradeIn;
Lab11identification();

cout << "Enter a numeric grade (0-100, -1 to stop): ";
cin >> gradeIn;
getNumericGrade (gradeIn);





return 0;
} // main

In the getNumericGrade function I need it to also print the letter grade how do I call to the function getLetterGrade correctly? I have been getting a compile error saying something about an implicit declaration of the function what does this mean?

The output should be....

Enter a numeric grade (0-100, -1 to stop): 120
The grade is out of range; try again.

Enter a numeric grade (0-100, -1 to stop): -6
The grade is out of range; try again.

Enter a numeric grade (0-100, -1 to stop): 84
The letter grade is B

Enter a numeric grade (0-100, -1 to stop): 77
The letter grade is C

Enter a numeric grade (0-100, -1 to stop): -1
Good-bye
Nov 23 '08 #1
2 1618
oler1s
671 Expert 512MB
In the getNumericGrade function I need it to also print the letter grade how do I call to the function getLetterGrade correctly? I have been getting a compile error saying something about an implicit declaration of the function what does this mean?
Post the exact error (by copy pasting). Also, edit your post and put all the code in CODE tags. Anything code like (including console input or output) is best put in code tags.
Nov 24 '08 #2
vmpstr
63
Compiler goes from top to bottom of a file as it is trying to compile your program. By the time it reaches a call to getLetterGrade in your getNumericGrade function, it hasn't seen any definitions or declarations of getLetterGrade, so it issues a warning (or an error).

To solve this, either reorder your functions so that for any given function, all of the functions that it uses are defined above it.

Another way (and in my opinion, a better way) would be to put the function prototypes for all your functions at the top of the file (after the includes)

something like the following:

Expand|Select|Wrap|Line Numbers
  1. int getNumericGrade(int gradeIn);
  2. char getLetterGrade(int gradeIn);
  3.  
Nov 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Bruce W...1 | last post by:
I'm a PHP newbie coming from experience with ASP.NET. I want to have a separate PHP file to support each HTML PHP page. This would be the equivalent of an ASP.NET code-behind file but using PHP....
2
by: Greg Chapman | last post by:
I am at my wit's end trying to get information out of Streamline.net's support dept about my problem. They reply quickly enough, but seem to try and give out the least possible amount of info each...
7
by: Tim ffitch | last post by:
Hi I have created a VB dll file that contains common functions I use across various projects in VB, Access and Excel. Rather than have to code the functions in each I decided to use the dll...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
6
by: Philip Warner | last post by:
I have a set of classes: C (base) C1 (inherits C) C2 (inherits C) ... Cn (inherits C) (the C1..Cn also have subclasses, but thats not really relevant to the question)
46
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or...
15
by: AmmarN | last post by:
Hi all, I have a c++ programme that intakes a binary file and performs various operations on it. I am not gonna get in to the details of the operations, currently i specify the order in which the...
5
by: GCRhoads | last post by:
I have some templated functions and I want to write a call wrapper class for it. I also want to pass the function object from this class to some functions that will then call the function...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
9
by: Andrew Poulos | last post by:
Say I have this: var foo = function(x, y) { return x + y; }; var bar = function(fname, param1, param2) { /* * how do I call the function "foo" * and pass parameters to it?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.