0

I would like to have the user enter ctrl-z to end the program...can someone tell me how to insert this into the following program?

```
//Program to calculate greatest common denominator of two integers
#include <iostream>
using namespace std;
int calcGCD(int, int);
int main()
{
int a, b, res;
cout <<"This program will determine the greatest common divisor of "
<< "two positive integers. ";
cout <<endl;
cout << "Please input your first positive number: ";
cin >> a;
cout << "Please input your second positive number: ";
cin >> b;
cout <<endl;
while ( a > 0 && b > 0 )
{
res = calcGCD ( a, b );
cout << "Greatest common divisior (GCD) of "<< a <<" and "<<b<<" is "<<res;
cout <<endl;
cout <<endl;
cout << "Please input your first positive number: (or ctrl-z to end program) ";
cin >> a;
cout << "Please input your second positive number: ";
cin >> b;
}
system ("pause");
return 0;
}
int calcGCD (int a, int b)
{
int c;
if ( a < b )
swap (a, b);
c = a % b;
if ( c == 0 )
return b;
calcGCD ( b, c );
}
/*
if ( b > a )
swap (a, b);
while ( b != 0 )
{
temp = b;
b = a - b;
a = temp;
if ( b > a )
swap (a, b);
}
return GCD;
system ("pause");
return 0;
}*/
```