#include "stdafx.h" #include<iostream> #include<iomanip > using namespace std; int main() { const int CIRCLE_CHOICE =1, RECTANGLE_CHOICE =2, TRIANGLE_CHOICE =3, QUIT_CHOICE =4; double PI =3.14159; double RectangleArea; double TriangleArea; double CircleArea; double length; double width; double Height; double Base; double radius; int choice; cout <<fixed<<showpoint<<setprecision(3); do { cout<<"\n\t\tGeometery Calculator Menu\n\n" << "1.Area of Circle\n" <<"2.Area of Rectangle\n" <<"3.Area of Triangle\n" <<"4.Quit Program!!\n\n" <<"Enter Your Choice: "; cin>>choice; while(choice<CIRCLE_CHOICE || choice>QUIT_CHOICE) { cout<<"Please Try again with the number 1-4:" ; cin>>choice; } if(choice == QUIT_CHOICE) { cout<<"Program ENDING\n" ; } if(choice == CIRCLE_CHOICE) { cout<<"Enter Radius:\n"; cin>>radius; cout<<"The Area of the Circle is:"<<CircleArea<<endl; } if (choice == RECTANGLE_CHOICE) { cout<<"Enter length:\n"; cin>>length; cout<<"Enter width:\n"; cin>>width; cout<<"The Area of the Rectangle is:"<<RectangleArea<<endl; } if (choice == TRIANGLE_CHOICE) { cout<<"Enter Height:\n"; cin>>Height; cout<<"Enter Base:\n"; cin>>Base; cout<<"The Area of the Triangle is:" <<TriangleArea<<endl; } switch(choice) { case CIRCLE_CHOICE: CircleArea = (PI)*(radius)*(radius); break; case RECTANGLE_CHOICE: RectangleArea = (length) *(width); break; case TRIANGLE_CHOICE: TriangleArea = (Base)*(Height)*(.5); break; } }while(choice != QUIT_CHOICE); return 0; }

Hello

My program is computing negative numbers when I put values in for my numbers it computes negative areas. I've tried and search for a results but couldn't find any because the results were above my knowledge of ctt i am still new to programming Its saying that My variables are not initialized. I actually tried the while loop but i found the do while loop better for validation. I've tried using if statements and found that the program runs more smoothly then my while loop i was trying to do.This is the edited version with if statements.

Actually made two different versions but i chose this to be the more organized manner. I'm not sure if my method is wrong, i'm trying to use the do while loop, but it appears that my numbers are negative. Any tips or ideas of how i can solve my issue.