Eric
2013-10-15 18:30:41 UTC
(.text+0x36): undefined reference to 'questions'
This is my code:
#include
#include
#include
float question1(float hours, float payRate, int type);
int question2(float error);
int question3(numYears);
int main()
{
question1(10,100,3);
question2(20);
questions(2013);
return 0;
}
float question1(float hours, float payRate, int type) // calculating the total pay for a worker.
{
float pay;
printf("Number of hours: %f\n hours", hours);
printf("\n");
printf("The pay rate is:$ %f\n", payRate);
printf("\n");
if (type == 1)
{
printf("Type of worker: hourly worker");
printf("\n");
pay = (payRate*hours);
printf("The total pay is:$ %f\n", pay);
}
else
if (type == 2)
{
printf("Type of worker: commission worker");
printf("\n");
pay = (0.057*payRate*hours);
printf("The total pay is:$ %f\n", pay);
}
else
if(type == 3)
{
printf("Type of worker: manager");
printf("\n");
pay = 550*(hours/168);
printf("The total pay is: $ %f\n", pay);
}
return 0;
}
int question2(float error) // Find the number of terms to calculate the percent difference between an infinite series of pi and its defined value.
{
float defined_value;
defined_value = 3.141592635;
printf("The defined value of pi is: %f\n", defined_value);
float x = error / 100.0;
float a;
float b;
float c;
float difference;
int count = 0;
while (difference < x)
{
b = 4/((2*count)-1);
if( count %2 ==1)
{
a = -1;
c = a*b;
}
else
{
a = 1;
c = a*b;
}
difference = defined_value - c;
count ++;
}
printf("The estimated value is: %f\n", c);
printf("The number of terms used is: %d\n", count);
return 0;
}
int question3(int numYears) // Find the world population in years starting from yr 2013
{
float a = 7e9;
printf("The population is currently: %f\n", a);
while( a!= 2*a)
{
a = a*1.018;
numYears = numYears+1;
printf(" In the year %d\n,", numYears);
printf("the population is: %f\n", a);
printf("\n");
}
if (a = 2*a)
{
printf("The population doubled in %d\n", numYears);
printf("THe population at that time is: %f\n", a);
}
return 0;
}
Can someone point out what i did wrong?
Thanks!