fork download
  1. #include <iostream>
  2.  
  3. //The compier needs these to know that you are going to have code later
  4. void print1();
  5. void print2();
  6.  
  7. int main() {
  8.  
  9. //Instead of typing this
  10. std::cout << "My favorite number is 2826" << std::endl;
  11. std::cout << "Wave Robotics Rocks!" << std::endl;
  12.  
  13.  
  14. //You could type this
  15. print1();
  16. print2();
  17.  
  18. return 0;
  19. }
  20.  
  21. //This is where the 'guts' of the functions go - outside of the main() function
  22. void print1(){
  23. std::cout << "My favorite number is 2826" << std::endl;
  24. }
  25.  
  26. void print2(){
  27. std::cout << "Wave Robotics Rocks!" << std::endl;
  28. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
My favorite number is 2826
Wave Robotics Rocks!
My favorite number is 2826
Wave Robotics Rocks!