I feel so stoopid

This is a discussion on I feel so stoopid within the C++ Programming forums, part of the General Programming Boards category; I can't do a goto loop. man, i really suck....

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    Unhappy I feel so stoopid

    I can't do a goto loop. man, i really suck.
    This war, like the next war, is a war to end war.

  2. #2
    Geek. Cobras2's Avatar
    Join Date
    Mar 2002
    Location
    near Westlock, and hour north of Edmonton, Alberta, Canada
    Posts
    113
    err.. a what loop?

  3. #3
    btq
    btq is offline
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    I can't do a goto loop. man, i really suck
    so does goto loops
    what do yo need it for anyway?
    you're most definetly better off with for or while or something
    similar,
    if you REALLY want goto loops post some code and I'll help
    /btq
    ...viewlexx - julie lexx

  4. #4
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    my book says do this:
    Code:
    #include <iostream>
    using namespace std;
    char n;
    char pass;
    char done;
    char start;
    int main()
    {
    start;
    cout << "enter password: ";
    cin >> pass;
    if(pass = 'secret')
    cout << "access granted, activating system 2342";
    clrscr();
    cout << "/nsystem error. Try again? ";
    cin >> n;
    if((n != 'y') goto done;
    else
    goto start;
    done;
    return 0;
    }
    This war, like the next war, is a war to end war.

  5. #5
    btq
    btq is offline
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    well, try exchanging the semicolon after the labels to a colon..
    that is instead of
    start;
    type
    start:

    haven't used em in ages though
    /btq
    ...viewlexx - julie lexx

  6. #6
    Registered User
    Join Date
    Aug 2001
    Posts
    244
    I think it should be

    start:

    not start;

    But I wouldn't know, since I've never used goto before. Why? because it SUCKS.

  7. #7
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    i get this error:
    line 2084: parse error before string constant.
    Looking at the code, does it look like a 2048 line code?
    This war, like the next war, is a war to end war.

  8. #8
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Im thinking the way to solve it is to use the book as fire starter....
    it was only $64.00
    This war, like the next war, is a war to end war.

  9. #9
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    what book is still promoting goto?
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  10. #10
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    teach youself c++ 6th Edition by al stevens
    This war, like the next war, is a war to end war.

  11. #11
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Avoid goto's until you *really* need them. Learn for and while for now.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  12. #12
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Originally posted by Blizzarddog

    start; //wrong label format
    ....
    if(pass = 'secret') //
    ....
    clrscr(); //no, no , no
    .....
    if((n != 'y') goto done; //notice the parenthesis
    ....
    done; //hehe
    Well, if this is code from a book.. wow.
    Originally posted by Blizzarddog
    Im thinking the way to solve it is to use the book as fire starter....
    That is a very good idea.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  13. #13
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    i can do while. for... hmmm. ill have to learn those.
    This war, like the next war, is a war to end war.

  14. #14
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Yepo, its ashes.
    This war, like the next war, is a war to end war.

  15. #15
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    Unfortunatly, it's not rare to find a book on the subject of programming with many inaccuracies to it... this book is definatly one of them!

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you feel...
    By ILoveVectors in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-16-2005, 06:47 AM
  2. When you don't feel like reading\programming..
    By Brain Cell in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 03-03-2005, 06:32 PM
  3. Feel Guilty..
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 01-22-2003, 03:00 PM
  4. creating a "information processing" feel
    By Rizage in forum C++ Programming
    Replies: 8
    Last Post: 09-02-2002, 04:48 PM

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