Thread: small problem
View Single Post
Old May 21st, 2005, 7:12 PM   #1
Navid
Hobbyist Programmer
 
Navid's Avatar
 
Join Date: Feb 2005
Location: Canada
Posts: 187
Rep Power: 4 Navid is on a distinguished road
Send a message via MSN to Navid
small problem

#include <stdio.h>

float tax = .15;
int price;

int main(void)
{
printf("What is the Cost?");
scanf("%d", &price);

#define total price*tax+price

printf("\nTotal cost= %ld\n",total);
system("pause");
return 0;
}

What it does is it asks for the cost of something, then gives you the cost after adding tax to it. But something is wrong with my variable "tax". Can anyone help please?
Navid is offline   Reply With Quote