• Welcome to Valhalla Legends Archive.
 

Compile Error!

Started by ViLeNT, October 10, 2007, 09:31 PM

Previous topic - Next topic

ViLeNT

Can someone please look at this code.

When I try to compile it I get a scrolling list of errors.

If someone could modify it and repost it.....or tell me what im doing wrong I would appreciate it!



#include <stdio.h>


void getInput(int *pNum1, int *pNum2);
void calc(int num1, int num2, int *pSum, int *pDivint, int *pRemdiv, double *pHal1, double *pHal2, double *pQuot, int *pModeqn);
void intOps(int num1, int num2, int *pSum, int *pDivint, int *pRemdiv);
void doubleOps(int num1, int num2, double *pHal1, double *pHal2, double *pQuot);
int algebra(int num1, int num2);               
void display(int num1, int num2, int sum, int divint, int remdiv, double hal1, double hal2, double quot, double modeqn);

int main(void)
{
printf("\nName: Jai Jensen");

int num1, num2, sum, divint, remdiv, modeqn;
double hal1, hal2, quot, modeqn;


getInput(&num1, &num2);
calc(int num1, int num2, &sum, &divint, &remdiv, &hal1, &hal2, &quot, &modeqn);
display(num1, num2, sum, divint, remdiv, hal1, hal2, quot, modeqn);

return 0;
}

// Prompts User for Input
void getInput(int* pNum1, int* pNum2
{
printf("\Please enter two numbers: ");
scanf("%d %d", pNum1, pNum2);
}

// Funtions for operations
viod calc(int num1, int num2, int *pSum, int *pDivint, int *pRemdiv, double *pHal1, double *pHal2, double *pQuot, int *pModeqn);
{
intOps(num1, num2, pSum, pDivint, pRemdiv);
doubleOps(num1, num2, pHal1, pHal2, pQuot);
*pModeqn = algebra(num1, num2)
}

// Furntions for integer opterations
void calcintOps(int num1, int num2, int *pSum, int *pDivint, int *pRemdiv);
{
*pSum = num1 * num2;
        *pDivint = num1/num2;
        *pRemdiv = num1 % num2;
}

// Functions for double operations
void calcdoubleOps(int num1, int num2, double *pHal1, double *pHal2, double *pQuot);
{
*pHal1 = .5 * num1;
        *pHal2 = .5 * num2;
        *pQuot = (1.0 * num1)/ (num2);
}

// Function for answering equation
int algebra(int num1, int num2);
{
int pModeqn;
pModeq = (2 * num1) + (4 * num2) + (num1 * num2) - (num1/num2);
return pModeqn;
}

//Display
void display(int num1, int num2, int sum, int divint, int remdiv, float hal1, float hal2, float quot, float modeqn);
   
   printf("\n%20s%20s", "Description", "Data");
   printf("\n%20s%20s", "-----------", "----");
   printf("\n%20s%20d", "Input 1", num1);
   printf("\n%20s%20d", "Input 2", num2);
   printf("\n%20s%20d", "Sum", sum);
   printf("\n%20s%20.1f", "1/2 Input 1", hal1);
   printf("\n%20s%20.1f", "1/2 Input 2", hal2);
   printf("\n%20s%20d", "Division", divint);
   printf("\n%20s%20d", "Remainder", remdiv);
   printf("\n%20s%20.4f", "Quotient", quot);
   printf("\n%20s%20.3f", "2x + 4y + xy + x/y", modeqn);
   printf("\n\n");

   return 0;
}



l2k-Shadow

umm.. look at what the compiler tells you the error is and fix it accordingly.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

ViLeNT

do you recommend any specific compiler? or can you be more specific and tell me what im doing wrong?

im currently using a shitty generic compiler the school provided.

l2k-Shadow

Well VS 2005 would be the way to go imo.

But I just put it into my Visual Studio 6 and got the following:

C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(17) : error C2371: 'modeqn' : redefinition; different basic types
        C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(16) : see declaration of 'modeqn'
C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(21) : error C2144: syntax error : missing ')' before type 'int'
C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(21) : error C2660: 'calc' : function does not take 0 parameters
C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(21) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(29) : error C2143: syntax error : missing ')' before '{'
C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(30) : warning C4129: 'P' : unrecognized character escape sequence
C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(35) : error C2146: syntax error : missing ';' before identifier 'calc'
C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(35) : error C2501: 'viod' : missing storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\Test\Test.cpp(35) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

rabbit

Quote from: ViLeNT on October 10, 2007, 09:39 PM
do you recommend any specific compiler? or can you be more specific and tell me what im doing wrong?

im currently using a shitty generic compiler the school provided.
Look at the function definitions again, and then look at what you're passing to the functions.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Chriso

Also, your calc function is missing the final semi-colon after *pModeqn = algebra(num1, num2).  That could be causing a few of your other problems.