![]() |
| |
Thread Tools Display Modes |
|
Really quick Functions tutorial - C++
GLoRY GuNz's really quick function tutorial (for u mamemam)
If you dont have the c++ add on for windows.h then just remove that:) Code:
#include <iostream>
#include <windows.h>
using namespace std;
//this is where you have to list any functions that you will be using for your program, and in this format
int function1();
int function2(); // will not be used just for example
//start of program; int main is the automatic fuction that c++ gives you, where the program looks first
int main()
{
function1(); // this will redirect the c++ compiler to go over to the next fuction
return 0;
}
int function1()
{
char choice;
cout << "choose y for restart or n for no restart" << endl;
cin >> choice;
switch (choice)
{
case 'y':
cout << "program will now restart" << endl;
system("PAUSE");
function1();//redirects to beginning of function and restarts code
break;
case 'n':
cout << "no restart" << endl;
system("PAUSE");
exit(2);
}
return 0;
}
__________________
Founder of the Rainbow 6 Vegas Teleportation Glitch The New James Bond Game is Made by ACTIVISION!! ![]() ![]() |
|||||||
|
cool thnx now i understand it bttr...and also about the windows.h or w/e it is there are alot of those thing that u need in oreder 2 run the program in some cases and some i dont have those...so if ur gunna use those that dont come witht the compiler then plz uplode the code or the file
EDIT: RapidShare: 1-Click Webhosting take a look glory
__________________
DONT CLICK HERE
![]() Quote:
Quote:
Quote:
Last edited by mameman2; 02-14-2008 at 08:42 PM.. |
||||||||||
|
I forget how i got the windows.h add on, all i know was it took me like 1 hr to find:)
__________________
Founder of the Rainbow 6 Vegas Teleportation Glitch The New James Bond Game is Made by ACTIVISION!! ![]() ![]() |
|||||||
|
int function1();
int function2(); shouldn't really be needed, unless your using a dumb compiler :) |
|||||||
|
i had it on there already cause i have visual 2008 beta
anyways the switch function is pretty basic im on about chapter 3 but i still need to review some stuff cause im doing it at a slow rate of once every weekened
__________________
![]() If you like my sigs rep me (thanks for the rep guys i appreciate the feedback!) |
|||||||
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|


























Linear Mode
