📜  如何在 C++ 代码示例中创建函数

📅  最后修改于: 2022-03-11 14:44:47.435000             🧑  作者: Mango

代码示例1
//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;
}