There are a lot of syntax problems with your code, so I'll just try to point out some general stuff, then you can ask again if you are still having trouble after you try to fix up your code:
All sentences in English must end in a period, otherwise people won't quite get what you are trying to say. Likewise, all C/C++ statements must end in semicolons, otherwise the compiler won't know what you are trying to do.
The purpose of declaring functions first with no body is to let the compiler know that those functions are indeed defined, although there definitions might be later on in the file or in an entirely different file. These are called "prototypes", or function "declarations", and take the general form of:
Code:
return_type function_name (parameter_list);
Note the semicolon. Example:
Code:
/* tell the compiler that we will be defining list() later,
so it won't complain. */
void list (void);
Functions must be declared before they are used, or else the compiler will whine about it.
When you
define a function (i.e. you write the actual code for the function rather than just declaring that the function exists), you use the following general form:
Code:
return_type function_name (parameter_list) {
function_body;
}
Note the lack of a semicolon after (parameter_list). For example:
Code:
void list (void) {
int n;
// do stuff here.
printf("I'm printing this.\n");
n = 34;
printf("n is %i\n", n);
}
All functions must be defined at some point. Otherwise, the linker will whine about it and you'll get "undefined reference" errors.
All variables used inside a function must be declared. If they aren't, then the compiler won't know what symbols represent variables, and what types of variables they represent. Simply doing:
Code:
void func (void) {
n = 23.0;
m = n;
}
Does not give the C/C++ compiler enough information to work with. Instead, you would have to do:
Code:
void func (void) {
float n, m;
n = 23.0;
m = n;
}
You can't end a line in the middle of a quoted string. However, putting two quoted strings in a row, separated only by spaces or newlines, will cause the compiler to join them in to one bigger quoted string when it compiles your code. So, the following two lines are the same:
Code:
printf("This is a string.\n");
printf("This " "is " "a " "str" "ing.\n");
With that in mind, if you need to use more than one line to specify a long string, do this:
Code:
printf("This is part of "
"a big string. "
"This is the end of it.");
Note that that will *not* actually print newline characters at the end of each of your lines. It will just print the whole string on one line. You have to explicitly tell printf to print newlines by inserting the character \n into your string when appropriate.
Sorry, I typed that pretty quickly. Hope it's coherent, and that it helps.
J.C.