Float/double compiler error and TONS of questions!

This is a discussion on Float/double compiler error and TONS of questions! within the C Programming forums, part of the General Programming Boards category; Looks like I'll be asking tons of questions in this forum from now Hope I don't make anyone irritated with ...

Well that's what I have so far.
I get the compiling error at the line "disc_amt = subtotal * DISCOUNT;"
Something like "cannot convert from float/double".
No idea what it means!

Please keep in mind that I'm writing this off a template... the template has just a few lines of coding. To be specific,
#include stuff, FILE * fileout;, void main (void), and fileout = fopen ("A:REPORT2.RPT","w"); are the only things in the template.

I could pretty much tell what fileout= fopen ... is but i'm not sure what the "w" is for.
As for "int", I'm just assuming I need this to include whatever variables I'm going to put in scanf and formulas.

2. About fprintf, I assume it pretty much works like printf but why would I need a ([B]fileout[\B], "bleh");?

Thanks for reading all this and for having patience with this complete newbie business I have here I appreciate it.

"FILE *fileout" is declaring a pointer to a file, meaning that it is a variable that contains the "memory address" of the output file.

void main(void): the first void means that the "main" function of the program does not return a value to the operating system... the second void means that the "main" function of the program does not accept any arguments (input) from the command line (or anywhere else) when it is called.

"w" means you are opening the file to WRITE to it, as opposed to read, Etc.

"int" means you are defining all of those variables to be integers. This can have some strange mathematical consequences since data past a decimal can get truncated.

fprintf prints out to a file rather than stdout (your display)... so, you need to tell it where the file is (using the file pointer, above).

I recommend checking out the tutorials on this site and elsewhere... a lot of these questions may be answered better there.

You are more or less correct on what "int" does. If you are going to use a variable(s) in your program, you need to tell the program what you are going to call them so it can look for them as it executes. There are several different types of variables that you can use and "int" is only one of them.

Unless you are expecting input to be entered in whole dollar amounts, you might want to change your variables to floats instead of int's.

int = integer, which is a whole number value (2, 45, -256, etc)

whereas

float = floating point, which is a decimal number (1.5, 45.67, $29.99, etc)

There are also: double, char, and char string[]. I will leave it to you to research these though, as I find it's easier to learn if you work with the information rather then just look at what "we" spit out