> website that you can copy and past codes and it will find wrrors and correct them.
Writing software is not like writing an essay where you can chuck in a paragraph and run a script that detects and fix grammar/spelling errors. When writing software, you and only you have to fix your errors that may occur, as frustrating as it sounds, it's all part of developing your programming skills.
Your code can be improved but it's not bad for a first program written, so good job. Here are some pointers I can give you:
First, not sure if that's a copy/paste issue, (although it seems likely that it is and I will point it out anyway) you do not capitalize data types or any C++ objects. C++ is a case-sensitive programming language, meaning Double is not the same as double. Another tip, try to minimize the amount of scopes you have in a function as it makes your code harder to follow. You will soon be familiar with object oriented programming where you can better rearrange and design your programs but for now it's fine to keep it all chucked in in one place. I see you are invoking the entire standard namespace only to use cout and cin. What you should do instead is only invoke the elements that you need from the standard namespace and this will reduce overhead and conflict problems that may occur in the future when you have many header and source files.
Instead of
#using namespace std;
try
1 2 3
|
#using std::cout;
#using std::cin;
#using std::endl;
|
You are also including the iomanip header file but you're not using any of its components either so you might want to erase that one.
EDIT: One final thing, always minimize the amount of global variables that you have as this will also make your code harder to follow. You have one function but multiple scopes, get rid of the scopes and chuck the PI variable inside the function.