c++ function with parameters code example

Example 1: what are parameters in c++

#include <iostream>

// Define name_x_times() below:
void name_x_times(std::string name, int x){
while(0 < x){
  std::cout << name << ""
}
}

int main() {
  
  std::string my_name = "Add your name here!";
  int some_number = 5; // Change this if you like!
  // Call name_x_times() below with my_name and some_number
  
  
} // this put shit inside of the shit, look back at your adventure.cpp code future me.

Example 2: c++ how to make function as argument

void func ( void (*f)(int) );

Tags:

C Example