Thread: Help with continuing to the next function.

  1. #1
    Registered User loopy's Avatar
    Join Date
    Mar 2002
    Posts
    172

    Help with continuing to the next function.

    Hello, i'm writing a simple text rpg and iv'e ran into a problem.
    Code:
    int main()
    {
      int i;
      printf("Please make your selection\n");
      printf("1.skate high park\n");
      printf("2.skate the beach\n");
      printf("3. get the hell out of this wannabe text skate game\n");
      scanf("%d", &i);
      if (i==1)
      printf("Let's skate to high park\n");
      else if (i==2)
      printf("Let's skate to the beach, i think outerworld is open too\n");
      else
      printf("under construction\n");
      {
        curb();
      }
      return 0;
    }
    The problem is i don't know how to continue on to the next function, it just end's. I'm sure most will agree that there's alot wrong with what you see above, but this is just for learning.
    Any help will be most appreaciated.
    Last edited by loopy; 04-25-2002 at 05:23 AM.
    WorkStation(new, a month ago):

    Sony Vaio i686 Desktop
    2.60 GIGhz Intel Pentium 4(HT)
    512Mb DDR RAM
    800MHz Front Side Bus!
    120 GIG IDE HardDrive
    Matrox G400 Dual-Head
    Linux kernel 2.6.3
    Modified Slackware 9.1
    GCC/GDB

    Multi-mon
    Simultaneous Multiple Processes

  2. #2
    Registered User loopy's Avatar
    Join Date
    Mar 2002
    Posts
    172

    we'll actually

    That give's me an idea on how to close it when the user input's anything but 1 and 2. But what i have *done* is created a function for different trick's and getting input for those trick's
    Code:
    int curb()
    {
      int a, b;
      printf("Were coming up to a waxed curb, what do you want to do, make it fast\n");
      printf("1. do an olie over it, yuk\n");
      printf("2. do a flip kick onto it, better\n");
      printf("3. do a big jump over it\n");
      printf("4. do a switch onto it\n");
      scanf("%d", &a);
      if ( a == 1 )
      b = OLIE;
      else if (a == 2)
      b = FLIP_KICK;
      else if (a == 3)
      b = BIG_JUMP;
      else if ( a == 4)
      b = SWITCH;
      printf("%d", b);
      printf(" point's\n");
      return a; 
    }
    Like do this and get so many point's, and soon i want to do like experience level's and some way to sometime's make the user fall
    stuff like that. My problem is i get to curb(); in the code in the first post and then it just end's. I know you can't have two BEGINS in a row, what do i put to get to the next function?
    If you understand my i take my hat off to you.
    thank's.
    WorkStation(new, a month ago):

    Sony Vaio i686 Desktop
    2.60 GIGhz Intel Pentium 4(HT)
    512Mb DDR RAM
    800MHz Front Side Bus!
    120 GIG IDE HardDrive
    Matrox G400 Dual-Head
    Linux kernel 2.6.3
    Modified Slackware 9.1
    GCC/GDB

    Multi-mon
    Simultaneous Multiple Processes

  3. #3
    Registered User loopy's Avatar
    Join Date
    Mar 2002
    Posts
    172

    I got it.

    Thank's for the help vVv.
    WorkStation(new, a month ago):

    Sony Vaio i686 Desktop
    2.60 GIGhz Intel Pentium 4(HT)
    512Mb DDR RAM
    800MHz Front Side Bus!
    120 GIG IDE HardDrive
    Matrox G400 Dual-Head
    Linux kernel 2.6.3
    Modified Slackware 9.1
    GCC/GDB

    Multi-mon
    Simultaneous Multiple Processes

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM