My program is not working and I can't figure out why, any help/suggestions would be greatly appreciated!!!
This is my program.....
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int rectangle_area, radious, area, width, length, height;
float circle_area, triangle_area;
const double PI = 3.14;
// Menu
cout << "Enter 1 for the radious circle" << endl;
cout << "Enter 2 for the width of the rectangle" << endl;
cout << "Enter 3 for the lenght of the triangle" << endl;
cout << "Enter 4 for the program to quit" <<endl;
while (1==1)
{
cout << "Choose Your option : ";
cin >> area;
cout << endl;
switch (area)
{
case 1:
cout << "enter the radious of a circle\n";
cin >> radious;
cout << " enter the area of a circle. \n";
circle_area= PI * radious * radious; //Calculates the area of a cirlce
cout << "area of the circle is " << circle_area << endl;
break;
case 2:
cout << "enter the width of a rectangle"<< endl;
cin >> width;
cout << "enter the length of the rectangle" << endl;
cin >> length;
cout << "enter the area of the rectangl" << endl;
rectangle_area = width*length; //Calculates the area of a rectangle
cout << "Rectangular Area =" << triangle_area << endl;
break;
case 3:
cout << "enter the length of a triangle" << endl;
cin >> length;
cout << "enter the height of a triangle" << endl;
cin >> height;
triangle_area = length * height /2; //Calculates the area of a triangle
cout << "Triangle Area=" << triangle_area << endl;
break;
case 4:
cout << "program quit" << endl; //Allows user to quit the program
system("pause");
return 0;
}
}
}
|
This is my output messages......
1>------ Build started: Project: Lab03-03GeometryCalculator, Configuration: Debug Win32 ------
1> MainCode.cpp
1>c:\cp107\cp107\lab03\lab03-03geometrycalculatorsolution\lab03-03geometrycalculator\maincode.cpp(40): warning C4244: '=' : conversion from 'const double' to 'float', possible loss of data
1>c:\cp107\cp107\lab03\lab03-03geometrycalculatorsolution\lab03-03geometrycalculator\maincode.cpp(60): warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
1>c:\cp107\cp107\lab03\lab03-03geometrycalculatorsolution\lab03-03geometrycalculator\maincode.cpp(77): fatal error C1075: end of file found before the left brace '{' at 'c:\cp107\cp107\lab03\lab03-03geometrycalculatorsolution\lab03-03geometrycalculator\maincode.cpp(17)' was matched
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========