Closing a programme with cin.get
Hi I am a beginner and just wrote a very small programme to calculate the circumference and area of a rectangle. The problem is when I compile the programme it just closes automatically in the end and I don't want it to close till I press enter. Here is the programme. The first time it calculate the circumference but when it reaches calculating the area, it just closes automatically after I enter the value for the width without showing the result. I used cin.get as you can see but it doesn't work.
Code:
#include<iostream>
using namespace std;
int main () {
double l, w, C, A;
cout <<"Length?";
cin>> l;
cout <<"Width?";
cin >>w;
C = w*2 + l*2;
cout <<"The circumference of the rectangle is"<<C<< endl;
cout <<"Length?";
cin>> l;
cout <<"width?";
cin>> w;
A = l*w;
cout<<"The area of the rectangle is"<< A;
cin.get();
}