Like Tree10Likes

printing out a string in mathematical formula

This is a discussion on printing out a string in mathematical formula within the C Programming forums, part of the General Programming Boards category; hey guys, i hav this stupid assignment in which the user enters an equation in the regular c notation like ...

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    8

    printing out a string in mathematical formula

    hey guys, i hav this stupid assignment in which the user enters an equation in the regular c notation like (sqrt((x+4)/(x+sin(x/15))...)and im supposed 2 print it out in the regular math notation..it's a gui recursive drawing fn or smth,and it's said 2 be easier after the rpn ( working on the postfix i mean ) which is no problem 2 me, but im so clueless about this drawing thing, so any help wd be greatly appreciated

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    134
    I believe You want to know about infix notation to postfix notation. You can read many article on this as one is here. Infix to Postfix
    S_ccess is waiting for u. Go Ahead, put u there.

  3. #3
    Registered User
    Join Date
    Jul 2011
    Posts
    8
    Quote Originally Posted by maven View Post
    I believe You want to know about infix notation to postfix notation. You can read many article on this as one is here. Infix to Postfix
    actually no, i can do the infix to postfix trick, but it's required after wards to somehow draw the initial equation in the plain mathematical formula, like there's no sqrt but the symbol of square root and fractions inside, no pow(,), it should be printed as a base and an index..

  4. #4
    Registered User
    Join Date
    Jun 2011
    Posts
    2,587
    Is the extended ASCII chart what you're looking for? (hint: second table)

  5. #5
    Registered User
    Join Date
    Jul 2011
    Posts
    8

    Talking

    here it goes, i should develop a program that takes an equation from the user written in c notation,(e.gow(x,2)) and then print it out as x2 and the same goes for the rest of math functions in c,input in c notation, output in math notation(the way u write equations in the math class), so far i only know it's a recursive gui function..some say it's easier 2 work on it after the rpn, i no how 2 rpn it but i dont find it helpful..do u find it stupid?? cuz i do..

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Every special symbol imaginable is available in unicode, but to do something like sub/superscripting, or square root or long division notation or something, you do need a gui. Those are platform specific and it won't be a matter of just learning a couple of functions -- you will have to learn the basics of the library first -- so I'd make sure that's what the assignment is supposed to be about and what gui libs you are suppose to use.
    stahta01 likes this.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Registered User
    Join Date
    Jul 2011
    Posts
    8
    yep, dat's pretty much the idea..of course sub,+,* are doable but for the division, it's a night mare really.. im kinda of a rookie programmer, so is there any specific library that can do that?? cd u plz mention a name??

  8. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I really really think you should double check the nature of the assignment. GUI programming is not trivial; it is going to take you a LOT of time -- possibly weeks -- to get all that worked out as a novice. So unless you are taking some course where you've missed most of the classes, etc, and are now trying to catch up, I doubt that is what is expected. It would also a pretty weird project IMO, because in order to grade it, the instructor would have to be familiar with the library, so they would have told you which one to use, because there is zero chance they are going to be familiar with all the possibilities.

    If you are really determined to use a GUI, the library depends on the platform you are programming for (windows, linux, mac).
    Last edited by MK27; 07-05-2011 at 09:19 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  9. #9
    Registered User
    Join Date
    Jul 2011
    Posts
    8
    u just said my opinion of my gui programming course, but the instrucrtor thinks we're able 2 do it with that primitive course, im actually going good except 4 that division part, the sqrt n power r fine but if there's a division it just goes wrong, so wt im trying 2 do is just 2 get familiar with the techniques of such stuff,im using window xp n yes im positive that is the nature of the assignment

  10. #10
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I'm not much of a windows user or programmer, but I believe the native API for this is just called "win32":

    Tutorial: Getting Started

    It may or may not have built in support for doing stuff like displaying math, if not there is probably a plugin around for it. But I'm warning you again: this is almost certainly the wrong path to be going down. You should really talk to your instructor or someone and let them know what you are doing just in case. As I mentioned, this will almost certainly take you several weeks to do, so you have plenty of time to ask before you waste all of it .
    stahta01 likes this.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  11. #11
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    FWIW... there are truetype fonts with mathematical symbols etc... that can be printed from windows GDI.

  12. #12
    Registered User
    Join Date
    Jul 2011
    Posts
    8
    this is wt i hav done so far, im trippin in some few points still like how 2 get the new x n y after recursion, anyonE who's willing to help, check the attachments
    Attached Files Attached Files

  13. #13
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by sar90 View Post
    this is wt i hav done so far, im trippin in some few points still like how 2 get the new x n y after recursion, anyonE who's willing to help, check the attachments
    Writing code in .h files is a major no no in C...

    You seriously need to visit a couple of tutorials...

    Do the reading, do the exercises, learn...

    Teach Yourself C in 21 Days -- Table of Contents

    When you finish that one, go for this one...

    theForger's Win32 API Tutorial

  14. #14
    Registered User
    Join Date
    Jul 2011
    Posts
    8
    Quote Originally Posted by CommonTater View Post
    Writing code in .h files is a major no no in C...

    You seriously need to visit a couple of tutorials...

    Do the reading, do the exercises, learn...

    Teach Yourself C in 21 Days -- Table of Contents

    When you finish that one, go for this one...

    theForger's Win32 API Tutorial
    well the thing is i dont have that much time now, the deadline is just 24 hours from now, so i just need 2 figure out the nxt move not start from scratch , specially with the gui

  15. #15
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by sar90 View Post
    well the thing is i dont have that much time now, the deadline is just 24 hours from now
    Code:
    #include<stdio.h>
    enum grade { F, D, C, B, A };
    struct bettingpool
    {
        enum grade expected;
        float wager;
        char name[ BUFSIZ ];
    };
    
    int main( void )
    {
        struct bettingpool[] =
        {
            { F, 100.00, "Quzah" },
        };
        ...
        return 0;
    }
    Any takers?


    Quzah.
    Hope is the first step on the road to disappointment.

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

Similar Threads

  1. how to find a mathematical formula for this recursion??
    By transgalactic2 in forum C Programming
    Replies: 12
    Last Post: 10-12-2008, 02:23 PM
  2. problem printing string
    By gkoenig in forum C Programming
    Replies: 4
    Last Post: 05-04-2008, 10:01 PM
  3. Problem with a mathematical formula
    By BianConiglio in forum C Programming
    Replies: 13
    Last Post: 04-29-2005, 11:26 PM
  4. Formula string conversion
    By Gr3g in forum C++ Programming
    Replies: 2
    Last Post: 04-12-2002, 08:28 PM
  5. printing a string
    By ktntech in forum C Programming
    Replies: 1
    Last Post: 01-24-2002, 04:09 PM

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