Hello techreport.

I am doing an extra credit assignment for my Computer Science class, and since so my professor wont help us or give us hints. Firstly, this is an introductory course to C programming and I'm pretty sure that my fundamentals will not be the best and I definitely know this is not the best way to solve this problem. But this is what works for me.

SO, I am stuck with my program. Heres what the problem is.

Calculate the value of a retirment portfolio by querying the user for the following information: To save time and space I will omit this part. This is not the part that is troubling me. Ok now, heres the goods.

My program using Borland 5.02:

/*Extra credit program: Calculate the value of a retirement portfolio

Spencer Alessi

March 2009

Version 1

Language C Borland 5.02

*/

#include <stdio.h>

#include <conio.h> //getch

//function prototypes

double initial_sal(void);

double salary_inc(void);

double salary_perc(void);

double rate(void);

double starting_year(void);

double finishing_year(void);

void calc_print(double initial_sal, double salary_inc, double salary_perc,

double rate, double starting_year, double finishing_year);

int main (void)

{ double yr, salary, starting, contributions, earnings, closing;

initial_sal();

salary_inc();

salary_perc();

rate();

starting_year();

finishing_year();

calc_print(yr, salary, starting, contributions, earnings, closing);

getch();

return 0;

}

double initial_sal(void)

/*function to get the initial starting salaray

Spencer Alessi

March 2009

C borland 5.02

*/

{double salary;

printf("Enter the initial starting salary: ");

scanf("%lf", &salary);

return (salary);

}

double salary_inc(void)

/*function to get the projected annual percentage salary increase

Spencer Alessi

March 2009

C Borland 5.02

*/

{double sal_inc;

printf("Enter the projected annual percentage salary increas (.00) form: ");

scanf("%lf", &sal_inc);

return (sal_inc);

}

double salary_perc(void)

/*function to get the percentage of salary to be contributed to

the retirement plan

Spencer Alessi

March 2009

C Borland 5.02

*/

{double sal_perc;

printf("Enter the percentage of the salary to be contributed to the plan: ");

scanf("%lf", &sal_perc);

return (sal_perc);

}

double rate(void)

/*function to get the annual rate of return on the earnings

Spencer Alessi

March 2009

C Borland 5.02

*/

{double rate_ret;

printf("Enter the annual rate of return on the earnings: ");

scanf("%lf", &rate_ret);

return (rate_ret);

}

double starting_year(void)

/*function to get the starting year and finishing year for contributions

Spencer Alessi

March 2009

C Borland 5.02

*/

{double start_year;

printf("Enter the starting year for contributions (example: 1940): ");

scanf("%lf", &start_year);

return (start_year);

}

double finishing_year(void)

/*function to ge the finishing year of contributions

Spencer Alessi

March 2009

C Borland 5.02

*/

{double finish_year;

printf("Enter the finishing year of contributions: ");

scanf("%lf", &finish_year);

return (finish_year);

}

void calc_print(double initial_sal, double salary_inc, double salary_perc,

double rate, double starting_year, double finishing_year)

/*function to calculate and print the value of a retirement portfolio

Spencer Alessi

March 2009

C Borland 5.02

*/

{char junk; //page control

double yr,

salary,

starting,

contribution,

contribution_value,

earnings,

rr,

closing;

printf("Year Salary Starting Contributions Earnings Closing\n");

while (yr >= finishing_year)

{yr=++yr;

salary=initial_sal * salary_inc;

starting=initial_sal * salary_perc;

contribution=starting * salary_inc;

contribution_value=starting + contribution;

earnings=starting * rr;

closing=starting + contribution + earnings;

if((yr%20)==0)

{ printf("Hit enter to continue");

scanf("%c",&junk);

printf("Year Salary Starting Contributions Earnings Closing\n");

}

printf("%f, f%, %f, %f, %f, %f\n", yr,salary,starting,contribution,

earnings,closing);

}

return;

}

When I try to run this, It gives me an error saying illegal use of floating point. When I take the page control if statement out, I get a bunch of never ending numbers for "year" and a bunch of %f printing out instead of the values I want. have fiddled with this for a while and cant figure out what i'm doing wrong. If anyone has any advice, tips, ect. I in no way want someone to finish this program for me, I am merely looking for tips and advice on what I did wrong or what I can fix. I appreciate any help.

Spence