I changed/fixed a few things.
The biggest notice is you will notice it is way way easier to read because I changed spacing.
The following:
Is exactly the same to the compiler as:
Code:
cout << "test";
//and the same for
cout << "test" ;
Use as many spaces, tabs and lines as you need to to make your code readable and easy to follow. And I personally always put { and } on lines all by them selves.
Code:
#include <iostream> //To use the library iostream.
using namespace std; //Too much to explain in such little space!
//http://www.cplusplus.com/doc/tutorial/namespaces.html
int mult ( int x, int y ); //function decleration
int main()
{
for (int i = 0; i < 10; i++ ) // To make a for loop, see lesson 3
{
int x;//Declaring variables
int y;
cout << "Input two numbers for multiplication: ";//Prompt user
cin> > x >> y;//To get input
cin.ignore();//To tell the program to ignore any 'extra' whitespace or return char
cout << "They multiply out to " << (x * y) << "\n";//Outputs to screen (and does math)
if ( x * y > 999 ) //If the returned variable is > 999, do following
{
cout<<"Aha! Testing my abilties are you?\n";
}//End if
else if ( x * y < 999 ) //If the returned variable is < 999, do following
{
cout<<"Pshh! Too easy!\n";
}//End else-if
else if ( x * y == 999 ) //If the returned variable is = 999, do following
{
cout<<"What are you trying to pull? This message is a 1/infinty chance!\n";
}
if ( x * y > 1 && x * y < 10 ) //If the returned variable is > 1 & < 10 do following
{
cout << "By the way, You should have known that one!\n";
}
}//End of for-loop
cin.get();//To require the use to press enter to continue
return 0;
}//End of main
int mult ( int x, int y ) //Something I made, and works right but I never used once in my code!
{
return x * y;//To tell it to return x * y when called upon
}