Hey guys,
Im new to the forum. Im going to school for web development and have been working on a program to calculate pricing for a made-up furniture company.
Anyway here's my code so far (sorry the txt isnt wrapped).
My question is:
The program compiles with zero errors but the math isn't calculating at all. PLEASE SOMEONE HELP! I HAVENT SLEPT ALL NIGHT
Code:
```#include <stdio.h>
#include <stdlib.h>
main()
{

char begin;
int length=0;
int width=0;
int area=0;
char woodtype;
int drawers=0;
double drawerCost=0.0;
double total=00.0;
double baseprice=200.00;

area=width*length;  \\i know this has to be wrong

printf("would you like to purchase a desk (y)es or (n)o");
scanf(" %c", &begin);

if (begin=='n')
{
printf("please reconsider a desk in the future\n");
return 0;
}
else if  (begin=='y')
{
printf("Lets Begin!\n\n");
}
else
{
printf("INVALID ENTRY!\n\n");

}

scanf("%d", &width);
area=width*length;

scanf("%d", &length);

if (area>750) \\if total area is over 750 we need to add \$50.00 to the total
{
total=baseprice+50.00;
}

else
{
total=baseprice;
}

printf("Your current total is %d\n",total); \\supposed to be a subtotal

printf("Desks come in three packages including three drawers, four drawers and five drawer options.\n\n");

scanf("%d", &drawers);
\\i made this easy because i didnt want to stress about anything else. so you only have 3 options for drawers...3,4, and 5

if (drawers==3)
{
total=total+90.00;
}
else if (drawers==4)
{
total=total+120.00;
}
else if (drawers==5)
{
total=total+150.00;
}
else
{
printf("INVALID ENTRY\n");

}

printf("Your current total is %d\n",total);  \\subtotal from area and the total drawers
scanf ("%c", &woodtype);

if (woodtype=='m')
{
total=total+150.00;
}
else if (woodtype=='o')
{
total=total+125.00;
}
else if (woodtype=='p')
{
total=total;
}
else
{
printf("INVALID ENTRY\n");
}

return 0;

}```

2. ## wrong order

Code:
```printf("Please enter width\n\n");
scanf("%d", &width);
area=width*length;

scanf("%d", &length);```
well one thing wrong is you are calculating area before you get input for length, move the scanf length line above the area calc line

3. thnkx. I FINALLY got it....feel incredibly dumb but thats what sleep deprivation does i guess.
in my variables i declaried baseprice as 200.00 and total as 0....long story short...cut out base price. fixed area and had printf("Your current total is %.2f\n",total); as a reminder to end user..got an A in CIS 126! thanks rogster

4. You're telling me it actually works, while you use "\\" to start a comment?