Code:
#include <stdio.h>
void getinput (int* pnum1, int* pnum2);
int calc (int num1, int num2);
void calcintops (int num1, int num2);
void doubleops (int num1, int num2);
int division (int num1, int num2);
// This doesn't work. Each argument must have a type.
void display (int num1, int num2, sum, quotient, remainder, half_num1,
half_num2, fraction, division);
int main (void)
{
// All unreferenced variables (ie not used anywhere). I assume you're going to use them when writing some more code later?
int num1,num2;
int sum;
double half_num1, half_num2;
int quotient;
int remainder;
double fraction;
int algebra;
return 0;
}
void getInput (int* pnum1, int* pnum2)
{
printf("\nName: Lauryn Philpot\n\n");
printf("\nPlease enter two integers, num1 and num2: ");
// This doesn't work. Arguments passed to scanf must be outsides the quotes ("").
scanf("%d%d, pnum1, pnum2");
}
void calcintops (int num1, int num2)
{
int sum;
int quotient;
int remainder;
sum = num1 + num2;
quotient= num1 / num2;
remainder = num1 % num2;
// You never return anything and the arguments aren't pointers, so the function is kindof pointless?
}
void doubleops (int num1, int num2)
{
double half_num1;
double half_num2;
double fraction;
half_num1 = (double)num1 / 2;
half_num2 = (double)num2 / 2;
fraction = (double)num1 / (double)num2;
// You never return anything and the arguments aren't pointers, so the function is kindof pointless?
}
int division (int num1, int num2)
{
// You can't name a variable with the same name as the function!
int division;
division = 2*num1 + 4*num2 + num1*num2 - num1 / num2;
// You never return anything and the arguments aren't pointers, so the function is kindof pointless?
}
void display (int num1, int num2, sum, quotient, remainder, half_num1,
half_num2, fraction, division)
{
// These are all wrong. I suggest you read up on printf again.
printf("\n%20s%20d", "The value of num1 is %d", num1);
printf("\n%20s%20d", "The value of num2 is %d", num2);
printf("\n%20s%20d", "The sum is %d + %d", num1, num2);
printf("\n%20s%20f", "The half value is %d / 2", num1);
printf("\n%20s%20f", "The half value is 2 * %d / 2", num2);
printf("\n%20s%20d", "The quotient is 2 * %d / %d", num1, num2);
printf("\n%20s%20d", "The remainder is %d % %d", num1, num2);
printf("\n%20s%20f", "The fraction value is 2 * %d / 2 * %d ", num1, num2);
printf("\n20s%20s", "The value of divisions is ", num1, num2);
printf("\n\n");
}
See comments in red.