How do you branch to another part of the program?

This is a discussion on How do you branch to another part of the program? within the C++ Programming forums, part of the General Programming Boards category; I'm confused!...

  1. #1
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942

    Question How do you branch to another part of the program?

    I'm confused!

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    lots of ways.... if statements, switches, function calls, gotos. I think you need to read a few tutorials especially on control statements and functions.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Using functions, iterations, selections and, in rare cases, goto.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    This is an example of overkill with gotos:

    Code:
    #include <iostream>
    
    char name[256];	
    
    int main( void ) 
    {
    
    	goto b;
    
    f:
    	return 0;
    
    e:
    	std::cout<<std::endl;
    	goto f;
    
    d:
    	std::cout<<name;
    	goto e;
    
    c:
    	std::cout<<"Hello ";
    	goto d;
    
    b:
    	std::cin>>name;
    	goto c;
    
    }
    Last edited by XSquared; 03-16-2003 at 11:30 AM.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  2. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  3. !!!Urgent Help on a group project!!!!!
    By AmeenR in forum C Programming
    Replies: 3
    Last Post: 12-13-2003, 08:22 PM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. redirection program help needed??
    By Unregistered in forum Linux Programming
    Replies: 0
    Last Post: 04-17-2002, 05:50 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21