Hi, I am two days into C++. I am looking into a teach yourself book on C++ if anyone has any recomendations, I'm all ears. I'm taking a class the textbook doesn't even cover C++ , its more about JAVA yet we are assigned a few scripts in C++. I have been okay with the last few, this one I just can't figure out.
I"m supposed to write a simple script using a for loop that will ask the user to input two numbers and it will output the highest common divisor of both numbers. I have this so far. My teacher has a habit of asking for us to do a project then the following day tells us he hasn't taught us what we needed to know to figure it out. If someone can offer help or the solution I would greatly appreciate it. I have been up until 1 am trying to figure it out, I think it is a concept I haven't been taught yet that I'm missing. Sorry I know my code is a mess so far.
CODE
# include <iostream.h>
int main ()
{
int p,q,i;
{
cout<<"Please enter two integers: ";
}
cin>>p>>q;
for (i=2; i<=p; i++);
{if(p%i==0 && q%i==0)
cout<<i<<" is your greatest common divisor of both numbers";}
return 0;
}