Feb 5, 2013 at 12:41pm Feb 5, 2013 at 12:41pm UTC
Hi! I have a problem in borland (i am new to borland, before i worked in dev c++ and codeblockxx) with the "if".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#include <iostream.h>
void main(){
int m, n, a3, a2, a1, aux;
cout<<"\n\n\n Enter a number: " ;
cin>>m;
cout<<"\n\n\n Enter a number: " ;
cin>>n;
if (m<n){
aux=m;
m=n;
n=aux;
}
a3=m;
a2=n;
a1=m-n;
while (a1>0){
a3=a2;
a2=a1;
a1=a3-a2;
}
if (( a3 == a2) and (a2 == 1 )) cout<<"Numbers are." ;
if ( ! (( a3 == a2 ) and (a2 == 1 )) ) cout<<"Numbers aren't." ;
}
Thanks in advace... Isengardium
Last edited on Feb 5, 2013 at 12:48pm Feb 5, 2013 at 12:48pm UTC
Feb 5, 2013 at 12:47pm Feb 5, 2013 at 12:47pm UTC
First of all I do not know what is the "if function". Secondly before using some C++ statement please read a book on C++ how to write such a statement.
I think that the problem is that and is not defined as keyword in Borland C++. Change it to &&
Last edited on Feb 5, 2013 at 12:49pm Feb 5, 2013 at 12:49pm UTC