Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 35

Thread: Here's a C problem

  1. #11
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: Here's a C problem

    Quote Originally Posted by TJRAK
    I did something similar to that in my Analysis of Programming Language (APL) class at UTECH. We were suppose to write a code the check the validity of an expression, whether it be prefix, postfix or infix. The code should take into consideration the inclusion of bracket so we had to take into consideration the precedence of operators. That program got me into a lot of trouble and taught me a valuable lesson
    Oh yeah i remember that one, but i did mine in java. hey which year u finish? maybe i know u..

  2. #12
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default Re: Here's a C problem

    This proplem should take me about a week, so to see it working, I almost drop of the chair. Bugs are minor

    I followed your code, but could you give me an overview of your method.
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  3. #13
    Join Date
    Mar 2004
    Posts
    123
    Rep Power
    0

    Default Re: Here's a C problem

    Quote Originally Posted by leoandru
    Oh yeah i remember that one, but i did mine in java. hey which year u finish? maybe i know u..
    Graduated last year. I did mine in C
    There is no wrong or right, only consequencies to action

    "It is the duty of man to make his knowledge so complete in life, so as to make it impossible for any other to take advantage of him" - Marcus Garvey

  4. #14
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: Here's a C problem

    Oh ok..
    for a expression like a+b*c basically it starts of by assuming that the first character is the result. result = a; then it goes on to recognize that the 2nd character is a + operator and simple stores that for the next calculation. when i runs into the operand b its takes the current result and the stored operator and carry out the calculation like a+b. so now result = a+b; it then stores the * operator and apply the same principle when it encounters c. I hope u understand.

  5. #15
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default Re: Here's a C problem

    Ok I think I understand, my bad for not full explaining the question in my first post.
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  6. #16
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default Re: Here's a C problem

    @Leo,

    What is the psudo code for the updated problem, before u start. Even working that out can take a week. The actual programming is easy as we can break it up amongst us three.
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  7. #17
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: Here's a C problem

    Quote Originally Posted by crosswire
    @Leo,

    What is the psudo code for the updated problem, before u start. Even working that out can take a week. The actual programming is easy as we can break it up amongst us three.
    umm. good suggestion. i'll work on it; gonna get some food to feed my brain .

  8. #18
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default Re: Here's a C problem

    ok tomorrow, me a go feed the masses too
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  9. #19
    Join Date
    Mar 2004
    Posts
    123
    Rep Power
    0

    Default Re: Here's a C problem

    Let me finish preparing for me C++ class then I get right on it. I'm considering using a stack. What's your take on this?
    There is no wrong or right, only consequencies to action

    "It is the duty of man to make his knowledge so complete in life, so as to make it impossible for any other to take advantage of him" - Marcus Garvey

  10. #20
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default Re: Here's a C problem

    I think a form of stack would be ideal for storing the operands so that memory use can be efficient. I will explain that later.

    Where would you use it? for operators or operands?
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •