Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //How to make functions work in other "functions".
- //1.Either you have to basically like declare that the function is gonna come so the c++ reads it.
- #include <iostream>
- using namespace std; //std is short for standard
- void printSomething(); //1.Basically declaring that the function is existing and will not give errors.
- int main()
- {
- printSomething();
- return 0;
- }
- void printSomething();
- {
- cout << "Text on the screen from function printSomething" << endl; //Here we give the function a value or mostly a function. :)
- }
- /*----------------------------------------------------------------------------------------------------------------*/
- //2.You can either just put the function Before the other function like this...
- #include <iostream>
- using namespace std;
- void printSomething();
- {
- cout << "Solved it!" << endl;
- }
- //And then the function you want to call it in wich is now int main()
- int main()
- {
- printSomething(); //To include the function of course :)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement