Thanks. I'm going to have to reread those sections again, but slower this time as lately I've been reading stuff faster then I can understand and having to read over.
The compiler is pedantic and unforgiving. That's its job.
Unlike interpreted languages like Python, you can't just execute isolated fragments of code in C. All code must be part of a function, and your program's code execution begins at the top of the function main(). You can't compile anything until you've got a complete module, and you can't build a program until you've got a module with a main() function in it. Simple programs typically consist of a single module containing main() and any other functions it needs.
The fragment you tried to compile isn't a complete module, it's an isolated example of use of the if/else construct. Furthermore, the ".... print out the cost ....." bit is meant to be filled in with whatever code is used to print the cost; it isn't valid C code.
Typical structure of a simple C program:
#include header files for any prebuilt libraries used
declarations of global variables
definitions of functions (subroutines)
The main() function does not necessarily need to appear at the bottom, but that saves you the trouble of needing to "forward declare" the other functions it calls. (This is explained near the bottom of the page you linked,)
Once you get past the simple "newbie" concepts like this, something else to keep in mind: The compiler will sometimes get confused by syntax errors, rendering subsequent errors irrelevant/meaningless. So if a particular error isn't making sense, try fixing the error(s) above it and compiling again.
Would it help if I look at correct source files to learn by example?
The examples further up the page you linked (immediately under "Your First Program" and "Data Types and Printf"), and further down (last 3 code blocks on the page) are complete, correct C source files.
Tip: If it doesn't start with some #includes and have a main() function somewhere, it's not a complete C program!