int main()
{
int length, width, perimeter, area, y, n, number = 1;
{
cout << "Enter length of rectangle: ";
cin >> length;
cout << "Enter width of rectangle: ";
cin >> width;
area = length*width;
perimeter = 2*(length+width);
cout << "The area of the rectangle is " << area << endl;
cout << "The perimeter of the rectangle is " << perimeter << endl;
cout << "Continue? (y/n) ";
cin >> y, n;
cin.ignore();
}
while (number = 2)
{
int length, width, perimeter, area, y, n, number = 2;
cout << "Enter length of rectangle: " << endl;
cin >> length;
cout << "Enter width of rectangle: " << endl;
cin >> width;
area = length*width;
perimeter = 2*(length+width);
cout << "The perimeter of the rectangle is" << perimeter << endl;
cout << "The area of the rectangle is" << area << endl;
cout << "Continue? (y/n)" << endl;
while (number = 2) was a problem but your exit conditions for the loop weren't correct either. The break will be called regardless of any conditions and so you will never loop.
The while needs to have a true/false statement that has a possibility of changing. This statement needs to be driven by a cin. I've made some changes below.
Also, you pretty much run the same code twice. Unless this was intentional, you don't need to do this. You could shorten the program by initializing your entry condition.
Also, in the original code you initialized your parameters twice. You should probably just do it once.