Hey fellas, I was learning about structures. Obviously, its not working.
I just made a simple program which prints out the area of a rectangle (using a function, which has the structure as its parameters.)
I am getting tons of error, in this short program.
Please help me out.
Function prototype not placed correctly, needs to be outside of main before main. You are making two box objects and not sure why one object has a height and a breadth just manipulate those.
usingnamespace std; - this exposes all names in the std namespace to your program.
There is already an std::distance, so this clashes with your use of distance as a type name.
You can choose a different name like "Distance", or get rid of the using directive, and either explicitly qualify all std objects like std::cout<<"therefore your area is "<<d3.area;, or use using declarations like using std::cout; // now you can use cout without fully qualifying it , and so on.
Also, your function declaration (line 17) is in the wrong place. You can't declare a function within a function (AFAIK, I'm not up to speed with C++11). Maybe move the declaration to the line before main().