Advertisement
TheWhiteFang

[C++][7] Functions

Oct 12th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream> //pre-processor directive
  2.  
  3. using namespace std; //std library
  4.  
  5. void printSomething(); //prototype a function so that the function is called 1st
  6.  
  7. int main() //it starts with the main 1st
  8. {
  9.     printSomething();
  10.     return 0; //to tell that program ran fine
  11. }
  12.  
  13. void printSomething(){ //function
  14.  
  15.     cout<< "text on screen" <<endl;
  16. }
  17.  
  18. //C++ works from top to bottom so unless the function is called 1st or there is a function prototypr before main, the program would not run properly
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement