I believe what MorphiusFaydal is saying is we cannot do your homework for you. If you are attempting to convert this program from pseudocode to c++ we can only help you if you run into a problem. I believe it's somewhere in the rules for these forums.
CODE
#include <iostream>
using namespace std;
int main()
{
int x,y,temp, remainder;
// read in the two integers
cout << endl;
cout << "Enter the first number (positive integer) : ";
cin >> x;
cout << "Enter the second number (positive integer) : ";
cin >> y;
//echo inputs
cout << "Input numbers are: " << x << " , " << y << endl;
if(x < y)
{ // exchange values of x and y
int temp = x;
x=y;
y=temp;
}
/* At this point we will always have x >= y */
//Initialize remainder.
x=y;
y=remainder;
remainder =(x % y);
// display the result
cout << endl;
cout << "The GCD is: " << y << endl;
int t;
cin >> t;
return (0); // terminate with success
}
I fixed it a little so now it will compile so all you have to do is fiddle around with it. I wasn't sure why you had a while statement there.
This post has been edited by Renzokusen: 15 Mar, 2008 - 08:51 AM