inside loop everything works fine, calculation and output. but when i enter while loop nothing shows up. i have no errors on debugging.
Sample Output
* Enter rectangle length: 3
* Enter rectangle width: 4
* The area of the rectangle is 12
* The perimeter of the rectangle is 14
* Continue? (y/n): y
* ...........................
* Enter rectangle length: 5
* Enter rectangle width: 3
* The area of the rectangle is 15
* The perimeter of the rectangle is 16
* Continue? (y/n): n
* Press any key to continue . . .
#include <iostream>
#include <string>
using namespace std;
int main()
{
int length;
int width;
int area;
int perimeter;
string choice;
length = 0;
width = 0;
area = 0;
perimeter = 0;
while (choice == "y" || choice == "Y")
{
cout << "Please enter length of the rectangle: ";
cin >> length;
cout << "Please enter widht of the rectangle: ";
cin >> width;
area = length * width;
perimeter = 2 * length + 2 * width;
cout << "The area of the rectangle is " << area << endl;
cout << "The perimeter of the rectangle is " << perimeter << endl;
Enter rectangle length: 3
Enter rectangle width: 4
The area of the rectangle is 12
The perimeter of the rectangle is 14
Continue? (y/n): n
.............................
Press any key to continue...