Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!
int asdf(int a, int b)
{
//remember it doesnt have to be 'a' or 'b', it can be anything just as long as you remember to be consistent
int value1;
value1=a*b //if i had the variables as 'q' and 'zps' or something then it would be value1=q*zps see?
return value1; //all this does is make the function return what we got for value1.
//so if i said in the main procedure or something 'thisvariable=asdf(10,20)'
//then it would return what value1 got when we put in 10 and 20 into the function.
//since the function multiplies them together and returns what it got from doing that,
//'thisvariable' will contain the return value, which would be 10*20 or 200.
}
#include <iostream>
#include <stdlib.h>
using namespace std;
int multiply(int a, int b);
int main()
{
cout << multiply(2, 4);
system("pause");
exit(0);
}
int multiply(int a, int b)
{
int c = a * b;
return (c);
}
#include <iostream>
#include <stdlib.h>
using namespace std;
void printmessage();
int main()
{
printmessage();
system("pause");
exit(0);
}
void printmessage()
{
cout << "This is my message";
}
void hello();
int main()
{
hello();
cout << "Goodbye world." << endl;
}
void hello()
{
cout << "Hello world." << endl;
}
#include <iostream> // This is required for cout and endl
#include <stdlib.h> // This is required for system and exit
using namespace std; // This is required for cout and endl
void hello()
{
cout << "Hello world." <<endl;
}
int main()
{
hello();
cout << "Goodbye world." << endl;
system("pause"); // This isn't portable so it is bad to use in examples.
exit(0); // This isn't required.
}