Thread: Ti-83 plus programming to C++ programming...

  1. #1
    Esparno
    Guest

    Ti-83 plus programming to C++ programming...

    I am a Ti-83 plus calculator programmer that just turned into a C++ programmer, how would i make this code into c++ code...

    Goto A
    "insert code here"
    lbl A
    if blah blah blah = blah
    goto B
    goto A
    lbl B
    "more code"
    goto A



    PS. I know how to do all the include <iosteam.h> and stuff, im not that much of a newby I just want to know how to make goto work in C++. I know to declare a label you use : instead of lbl.
    PPS. Please dont flame me

    -We are not even here, the Matrix isnt even real, its all part of a bigger picture, a "Quasi-Matrix" if you will...

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    thing:
    //blah bhsfdgsg
    goto thing;

  3. #3
    Unregistered
    Guest
    Since most of use here are not Ti-83 programmers I doubt if many of us know what the code segment you posted is supposed to do to even guess how to do it in C++. there are two goto commands in C++. one allows you to jump in code and is shunned, the other allows you to place the cursor at a given spot on the screen and is used in a variety of settings. As a general rule the flow of a program is governed by function calls, if/else if/else statements, switch statements, etc.

  4. #4
    Esparno
    Guest
    I mean the way that you said is shunned, the one that jumps in code, what i meant for it to do is to goto A, then goto B, then go back to A, when I try to do it it doesnt work, it goes down the code, but not back up the code, I dont care if it is shunned, I find that way easier to program and I have yet found a way that works as well as it.

  5. #5
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > Since most of use here are not Ti-83 programmers I doubt if many of us know what the code segment you posted is supposed to do to even guess how to do it in C++.

    I dunno... I though it was pretty obvious....

    >the other allows you to place the cursor at a given spot on the screen and is used in a variety of settings

    Right, but it's not standard...

    Esparno:
    You're sure that won't jump back up code? AFAIK, it should do that just fine, just as long as you're not using it to try to jump out of a function...

  6. #6
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Finally, someone with the same background as me. That was my sole relief in math class when the teacher was repeating himself for the tenth time.

  7. #7
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    I dont care if it is shunned, I find that way easier to program and I have yet found a way that works as well as it.
    Yeah, try coding something 100> and I think you'll find goto is no substitute for while, do..while etc.

  8. #8
    Registered User
    Join Date
    Jan 2002
    Posts
    387

    Re: Ti-83 plus programming to C++ programming...

    Code:
    goto A;
    //insert code here
    A:
    if(blah blah blah == blah)
        goto B;
    else
         goto A;
    B:
    //more code
    goto A;
    that would be my best guess

  9. #9
    Registered User
    Join Date
    Feb 2002
    Posts
    145

    Arrow Ti 83+ conversion

    For one thing, what exactly are you doing programming a calculator? Math stuff? Physics formulas? Anyhow, I have used the Ti 83+ stuff a bit for school, and my best shot at converting it is below (althought I still don't see why you are going to A right away).


    --------------------------------------------

    goto A;
    "All your code here"

    A:
    if (blah blah == blah)
    {
    goto B;
    }

    B:
    "More code"
    goto A:

    --------------------------------------------

    I still don't see the logic of your original code, there seems to be a lot of wasted lines that mean nothing (like Goto A all over the place). Anyhow, this is my best guess, but you could just try learning the basics of C++, it isn't that hard to code something like you want.

  10. #10
    His posts are far and few Esparno's Avatar
    Join Date
    Mar 2002
    Posts
    100
    The whole point of the code is to go to B then go back up to A, look again.

    Lbl A
    if blah = blah
    goto b
    lbl b
    blah
    blah
    goto A

    C++ equivalent (or what I thought would work)

    A:
    if (blah = blah)
    {
    goto B
    }
    B:
    blah
    blah
    goto A

    Now when I tried that it didnt work... So please help

  11. #11
    His posts are far and few Esparno's Avatar
    Join Date
    Mar 2002
    Posts
    100
    There Is no point to this code right now, I just want to figure the right way to do goto statements.
    Signature is optional, I didnt opt for one.

  12. #12
    Unregistered
    Guest
    #include <iostream.h>

    void A()
    {
    for(int i = 0 i < 4; i++)
    {
    cout << 'A' << endl;
    B();
    cout << 'C' << endl;
    }
    }

    void B()
    {
    cout << 'B' << endl;
    A();
    //cout << 'D' << endl;
    }

    int main()
    {
    A();
    return0;
    }


    should produce :

    A
    B
    C
    A
    B
    C
    A
    B
    C
    A
    B
    C

    and if you remove the // I think it will tack 4 Ds to the end of the list.

  13. #13
    Unregistered
    Guest
    oops---------error correction to the program I just posted:

    place // before the line

    A();

    in the funciton

    B()

    otherwise you've got to go through the for loop in A() 4 times for each call to A() from B() in addition to the 4 times from the call from main(). Doesn't pay to get too tricky with spagetti code!!

  14. #14
    His posts are far and few Esparno's Avatar
    Join Date
    Mar 2002
    Posts
    100
    No No No, See im not ready to change from goto to for or while, im going to stick with goto and I want someone to explain why my program doesnt work, Actually it might work, I tried it a while ago but Im at school now and I cant tried out all or ur suggestions yet till I get home.
    Signature is optional, I didnt opt for one.

  15. #15
    Registered User
    Join Date
    Feb 2002
    Posts
    93

    Ah the ole' calculator

    Goto A
    "insert code here"
    lbl A
    if blah blah blah = blah
    goto B
    goto A
    lbl B
    "more code"
    goto A


    I did a little calculator programming b4.. gotta pass time in those boring classes somehow right?

    easiest way to do this is

    int main()
    {
    int b = 4; //main coding

    gotoa(); //call the function gotoa;

    }



    void gotoa()
    {
    if (b != 5) //if b is not equal 5 then gotob else goto a
    {
    gotob(); //calls the function gotob if b not equal to 5
    }
    else
    {
    gotoa(); //if b is equal to 5 calls the function gotoa
    }
    }

    void gotob()
    {
    b = b + 1; //takes b and adds 1 to it then goes back to a
    gotoa(); //calls the function goto a
    }


    lol been a while since i done anything in a calculator... TI programming is very simple and really can't do too much so its hard to convert it into c++... but using functions is your best bet..
    Just consider each function as a label... and each function call as your goto statement... when i first started c++ i wanted to use goto too cause it's pretty easy.. but right now i'm writing a program with a couple thousands lines of code.. and with the goto type programming you will get confused, and you will confuse the people reading your code... plus you have to type alot more.... just learn functions.. they are the easiest way to program in c++ or any other language for that matter

    edited:

    oops hehe thnx for that.. without that he probably woulda been even more lost..
    Last edited by tegwin; 03-04-2002 at 01:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. TI 89 Programming
    By alpha in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 02-27-2003, 06:14 PM
  2. TI 89 Input routine with comma, backspace and sign
    By overspray in forum C Programming
    Replies: 1
    Last Post: 01-14-2003, 05:51 AM
  3. TI Flash Apps
    By Korn1699 in forum C Programming
    Replies: 1
    Last Post: 04-01-2002, 03:01 AM
  4. GForce4 Ti Game engine
    By novacain in forum Game Programming
    Replies: 3
    Last Post: 02-23-2002, 12:46 AM
  5. TI Tetrinet
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-10-2001, 08:34 PM