how to calculate a body

i dont know what is worong
and how to input header files in my programm.
i am using codeblocks thanks for helping.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
void read (body * const f)
{


    printf("size:");
    scanf("%hi",&(f->a));
    printf("form:");
    char *form =(char*)calloc(60,sizeof(char));
    scanf("%s",form);
    f->form = form;
    return;
}
double volumen(body * const p)
{
    if (0 ==strcmp ("txt",p->form))


           return pow(p->a,2)/12*sqrt(2);


   if (0 ==strcmp ("exe",p->form))

            return (pow(p->a,2)/4)*15 + (7 * sqrt(5));

}
int main() {

    body p = {0};
    read(&p);
    printf("Seite :%i\n",p.a);
    printf("form : %s\n",p.form);
    double V = volumen(&p);
    printf("volumen %f",V);
}
Not sure what 'body' means here. It looks to be related to geometry / volume but I don't understand exactly what you seek.

you can include via the #include statement which are by convention the first thing in the program usually, at the top.

#include<header> //the compiler knows what and where this is, either because you told it in settings or because its part of the language, such as #include<vector>.

#include<"path\filename" //you know where the header is, and explicitly pull it in this way. Eg #include "C:\inc\common\my_stuff.h"

#include "filename" //its in your project path but not the compiler's search paths. eg #include "myclass.h"

Those are the 3 most common forms.

Sorry to get pedantic, and a bit off topic, but you should avoid backslashes in C/C++ includes, it's all-around more portable to use regular slashes. Better safe than sorry.
https://stackoverflow.com/questions/5790161/is-the-backslash-acceptable-in-c-and-c-include-directives
heh I would argue that c:/folder/file probably won't work on unix no matter what slash you use. But you are totally correct, it is better (usually you use relative paths not absolute, so the drive convention goes away).

Topic archived. No new replies allowed.