Original Post
how do i use goto for my text game i know i shouldnt but it looks like it would be easier. like having area1 area2 then using goto area1 how would i do this?
Quote:
Original post by theadamSGT
how do i use goto for my text game i know i shouldnt
void Area1() { // do something}Area1();
int Area1(int a, int b){// do stuff} Area1(a, b); // you can pass it any two values, as long as they're integers#include <iostream>using namespace std;int Area1(int a, int b); // function prototypes to allow functions declared before // the caller to know about itint main(){ int a = 5; int b = 7; cout << Area1(a, b); // you're giving the function values of a and b cin.get(); }int Area1(int a, int b){ // the variabels can be anything in the prototypes int c = a + b; // adds the values of a and b LOCAL to that function // it doesn't affect the original variables in main return (c); // gives back value to output}Quote:
Original post by theadamSGT
i know functions very good already so i dont need any examples of functions unless its advanced functions.
Quote:
[qoute]Couldn't you just call another function or something like that?[/qoute]
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more