What do I need to change when I paste this. I get problems for these two
#include %26lt;iostream%26gt;
using namespace std;
.........................................
#include %26lt;iostream%26gt;
using namespace std;
int factor(int a, int b);
int main()
{
int x, y;
cout %26lt;%26lt; "This program allows calculating the factor\n";
cout %26lt;%26lt; "Value 1: ";
cin %26gt;%26gt; x;
cout %26lt;%26lt; "Value 2: ";
cin %26gt;%26gt; y;
cout %26lt;%26lt; "\nThe Greatest Common factor of "
%26lt;%26lt; x %26lt;%26lt; " and " %26lt;%26lt; y %26lt;%26lt; " is " %26lt;%26lt; factor(x, y) %26lt;%26lt; endl;
return 0;
}
int factor(int a, int b)
{
while( 1 )
{
a = a / b;
if( a == 0 )
return b;
b = b / a;
if( b == 0 )
return a;
}
}
C++ Help plz?
i guess it should be #include%26lt;iostream.h%26gt;
Reply:i think you cant see your result.
try this, at first :
#include%26lt;iostream%26gt;
#include%26lt;conio.h%26gt;
and before return 0, in main type:
getche ();
enjoy...
apple
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment