0
How to make a program using function?? And what is the difference btw in main and function.
3 Respostas
+ 1
A main function is the heart of your application, you need it to tun your application, but other functions aren't necessary. you use functions for the following reasons:
* you need the code multiple times (to avoid code repetition)
* you can make your returns so that you can easily get a certain number.
0
but how I write a program using function ??? can u give an example...
0
int main() {
if(greaterThan(2, 1)) {
std::cout << "hi" << endl;
}
return 0;
}
boolean greaterThan(int x, int y) {
return x > y;
}
so now it would say hi, this is because the function elevates to true