Errors in C Code


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Errors in C Code
# 1  
Error Errors in C Code

For my programming class I need to write a program that reads a ground number and a power, calculates, and then prints the answer on screen.
for this program the teacher makes me use pointers and different sub programs for the input output and calculation.

my code is:
Code:

/*Libraries*/
#include<stdio.h>
#include<conio.h>
/*Subprograms*/
void input(int *, int *);
void To_Decimal(int *, int *, int *);
void Output(int,int,int);
/*Main program*/
int main()
{
/*variables*/
char chAgain = 'y';
while(chAgain == 'y')
{
/*variables*/
int nGround = 0, nPower = 0, nDecimal = 1;
/*goto subprogram input*/
input(&nGround,&nPower);
/*check arguments*/
if(nGround < 10)
{
/*goto subprogram to decimal*/
To_Decimal(&nGround,&nPower,&nDecimal);
 
/*goto subprogram output*/
Output(nGround,nPower,nDecimal);
}
else
{
printf("\nThe ground number you have entered is 10 or a higher number");
}
printf("\nDo you want to run the program again? [y/n]: ");
chAgain = getche();
}
 
return 0;
}
/*subprogram input*/
void input(int *pGround, int *pPower)
{
printf("\nEnter a ground number below 10: ");
/*read the ground number*/
scanf("%d",pGround);
printf("\nEnter a Power: ");
/*read the power*/
scanf("%d",pPower);
}
/*subprogram to decimal*/
void To_Decimal(int *pGround, int *pPower, int *pDecimal)
{
/*do the math*/
int i;
for (i = 0; i < *pPower; i++)
{
*pDecimal *= *pGround;
}
}
/*subprogram output*/
void Ouput(int nGround, int nPower, int nDecimal)
{
printf("\nThe outcome of the groundnumber: %d and the power: %d is %d",nGround,nPower,nDecimal);
}

I'm getting 2 errors when I try to compile.

Code:
error LNK2019: unresolved external symbol "void __cdecl Output(int,int,int)" (?Output@@YAXHHH@Z) referenced in function _main

Code:
Error 5 error LNK1120: 1 unresolved externals

can someone please help me to solve them.


school: Saxion High school
city: Enschede
Country: Netherlands
Name of Professor: Mr. Verbruggen
Course name: Programming 2
# 2  
It's a simple typo: you declare and use void Output(int,int,int);, but defined is void Ouput(int nGround, int nPower, int nDecimal)
This User Gave Thanks to pludi For This Post:
# 3  
looked over it for half an hour, and couldn't find it.
many thanks
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #745
Difficulty: Medium
The Austrian Computer Kit (ACK) is a retargetable compiler suite and toolchain written by Andrew Tanenbaum.
True or False?

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Errors using ln

ln: Filename1 and Filename2 are identical. Seems to be an error.. Unable to proceed further Can you ppl help me? (5 Replies)
Discussion started by: DevM
5 Replies

2. UNIX for Dummies Questions & Answers

Major OS errors/Bash errors help!!!!

Hi all, dummy here.... I have major errors on entering the shell. On login I get: -bash: dircolors: command not found -bash: tr: command not found -bash: fgrep: command not found -bash: grep: command not found -bash: grep: command not found -bash: id: command not found -bash: [: =: unary... (12 Replies)
Discussion started by: wcmmlynn
12 Replies

3. Programming

errors....

hi i have written a program to display files in a directory but it doesnt compile on the sun/solaris system.... im using gcc(inbuilt compiler) im generally used to working on a windows environment so maybe im overlookiing something ive added comments to help readability of the program i also... (2 Replies)
Discussion started by: anything2
2 Replies

4. UNIX for Dummies Questions & Answers

X errors

I'm trying to set up x2x between my desktop and laptop, and as a precondition to that, I'm just trying to get each to be able to display programs on the other (e.g. "desktop$ xterm -display laptop:0"). OS is Ubuntu 5.10 and X version is X.org 6.8.2 I've set up X to run without -nolisten, and... (1 Reply)
Discussion started by: vertigo23
1 Replies

5. UNIX for Advanced & Expert Users

What are these errors?

root@INTSETICADB # su - oracle Killed root@INTSETICADB # su - selectica Killed root@INTSETICADB # man prstat Reformatting page. Please Wait...Segmentation Fault - core dumped sys(cd /usr/man; /usr/lib/sgml/sgml2roff /usr/man/sman1m/prstat.1m > /tmp/sman_iUaW5x) fail! aborted (sorry) (3 Replies)
Discussion started by: abhijeetkul
3 Replies

6. AIX

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (2 Replies)
Discussion started by: mcastill66
2 Replies

7. UNIX for Advanced & Expert Users

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (0 Replies)
Discussion started by: mcastill66
0 Replies

8. HP-UX

errors

fatal server error: couldn't open x pointer device! is one attached? xinit: connection refused (errno 239): unable to connect to X server xinit: no such process (errno3): server error. (1 Reply)
Discussion started by: nobody
1 Replies

Featured Tech Videos