| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
| Getting Started with Functions; How to make and start using functions | |
|---|---|
| Tweet Topic Started: Aug 10 2008, 06:25 PM (383 Views) | |
| Gandalf20000 | Aug 10 2008, 06:25 PM Post #1 |
![]()
Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
You've made your first C++ program. You managed to get the system to create a little DOS window that says, "I'm a C++ program!" or something like that. But, you want to move on to harder stuff and learn some more. You read up about functions, but you can't understand what the crap the tutorial is saying. That is where this tutorial comes in. You've seen that little "main(blahblahblah)" thing you write in every C++ program. That is a function. However, that function simply is used to make the program usable. Here is how you make a function in C++:
Okay. Now you've written a function. But how on earth do you use it?! First of all, you create the function in a separate header file or before main() is initiated. Second of all, you use it like this in the main() function:
And now you (hopefully) know how to make C++ functions. For a source file I made using functions: C++ Functions This file has some stuff that wasn't mentioned in the tutorial, but it is commented, and will hopefully help you learn. |
![]() |
|
| « Previous Topic · Tutorials · Next Topic » |






![]](http://z1.ifrm.com/static/1/pip_r.png)



9:02 PM Jul 11