I see a number of things that may help you improve your code.
Prefer portable code
This code could be entirely portable if the
#include "stdafx.h" were omitted. It's Windows specific and doesn't really help here, even on Windows.
Understand header include paths
There is a subtle difference between
#include "iostream" and
#include <iostream>. Although it's implementation defined, most compiler implementations is that the quotation mark form searches locally first (e.g. the current directory) and then searches system include directories if that fails. The angle bracket form usually searches in system include directories. See https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename for more.
Fix your formatting
The code is all jammed up on the left margin with no indenting. I don't know if that's how you wrote it or if it's a cut-and-paste error when posting the question, but it really makes the program hard to read. It makes no difference to the compiler, but you should strive for a good consistent style that includes visual clues for the human reader of your code.
Fix the bug
calcSphereMesures routine is returning the address of a variable that's local to that routine. That's a bug. If you need to return multiple values, either pass in a pointer to an appropriate structure to be filled in by the routine or allocate one using
new and returning that. I'd prefer the former, because it makes ownership of the structure a little cleaner (that is, the caller must both allocate and free the structure). Note that although I'm using the word structure, here, that isn't necessarily a
struct -- it could just as well be an array or some other data structure.
Consider using an object
The area, circumference, etc., could all be attributes of a
Sphere class. This would have the advantage that one could write
sphere.diameter() instead of
results for example.
Use name spaces
#include <cmath>, it brings those functions into the
std:: namespace and may also put the symbols into the global namespace. You're counting on the latter which is not guaranteed by the standard. You can fix that by using
std::pow instead of just
Use a better value of \$\pi\$
There's little point in asking for the precision of a
double if you're going to approximate \$\pi\$ as
Understand the use of function declarations
A function declaration is required before the use of the function. Your separate declaration and implementation of the
calcSphereMesures() function would make sense if the declaration were in its own header file, but that's not the case here. For that reason, I'd suggest eliminating the declaration -- keeping them synchronized is just another task that you can eliminate.
Check your spelling
The word "measure" is consistently misspelled within the code. It would be nice to fix that.