how to create c++ function code example
Example 1: How to make a function in C++
//first lets create a function
/*void is for starting something, anything after void will be the name of your
function which will be followed by () */
void yourFunction() {
//your code will be here, anything here will be the code in the yourFunction
cout << "Functions"
}
//now we have to go to our main function, the only function the compiler reads
int main() {
myFunction(); //you call the function, the code we put in it earlier will be executed
return 0;
}
Example 2: functions in C++
void Hello() {
std::cout << "Hello";
}
int main () {
Hello();
}