Link to home
Start Free TrialLog in
Avatar of nellia
nellia

asked on

Tax calculator with menu

This is my project and this is what I have so far, it wa able to compile but there is a linker error.  
Project: Tax calculator that multiply the tax rate by the purchase amount 100.00.  Then I have to modify the
simple tax calculator by adding a menu.  Itried to combine the two in one project and was able to compile, but have a linker error:

This is what I have
#include<stdio.h>
/*DelMar = 7.25 %/
/*Encinitas = 7.50%/
/*La Jolla = 7.75%/

printf("Tax Calculator\n");
//prompt the user to enter amounts
printf("\nSelect (a) calculate tax\n");
printf("\nSelect (0) to exit\n");
scanf("%c", &userSelect);
tax=price*0.0725;// Del Mar tax calculation
tax=price*0.0750;//Encinitas tax calculation
tax=price*0.0775;//La Jolla tax calculation
switch (task){
{
 case 1: DelMar:
      {      
      rate = 7.25;
      break;
      }
 case Encinitas:{
      rate = 7.5;
      break;
     
 case La Jolla:
      rate = 7.75;
      break;
     
}
int main()
{
     int task;
     char c;
     float myAmount;
     do
     {
         
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Hi nellia,

You should have several compilation errors.  You have unbalance { } all over the place.  The linker error is probably coming from the fact that the program won't compile so your object file has no main() function.

Good Luck!
Kent
Avatar of nellia
nellia

ASKER

But it actually compiled, gave me a linker error only.  Usually I get a compiler error.  Unbalance?
Hi nellia,

Check out main.  You have two lefts, the second one initiates an incomplete do/while.

You've got code outside of any function.  The line:

printf("Tax Calculator\n");

and those following it can never get executed.


Kent
Avatar of nellia

ASKER

Linker Error (Severity 4)
      Module "cruntime.asm" in file "c:\program files\miracle c\ccl.lib "
      references unresolved external "_main"
      at offset 0092H in segment "_text".

Is what I am getting
That is because of what Kdo said : your main .c file didn't compile, so when the linker looked for it it couldn't find the compiled object file for it ... hence the error.

What compiler are you using ?

Start by putting your code INSIDE the main() function ...
ASKER CERTIFIED SOLUTION
Avatar of cwwkie
cwwkie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial