Thread: Turbo C++ STACK, QUEUE, FIXES

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    10

    Turbo C++ STACK, QUEUE, FIXES

    how can i do i stack, queu and postfix, prefix ,infix demonstration program using Turbo C++ 3.0's graphical interface. Can you help me or can you give me some hints about combining graphic functions and program functions(pop,push..)
    Code:
    #include <graphics.h>
    #include <mouse.h>
    #include <conio.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include "stack.h"
    #include "queue.h"
    void ekran();
    
    main()
    {
    int gdriver = DETECT, gmode, errorcode;
    
    initgraph(&gdriver, &gmode, "");
    
    errorcode = graphresult();
    
    if (errorcode != grOk) 
    {
       printf("Graphic error: %s\n", grapherrormsg(errorcode));
       printf("˜Press any key:");
       getch();
       exit(1);           
    }
    
    setcolor(YELLOW);
    rectangle(0,0,getmaxx(),getmaxy());
    SetMousePosition(getmaxx()/2,getmaxy()/2);
    ShowMouse(); ekran();
    return 0;
    }
    
    
    
    void ekran()
    {
    setbkcolor(9);
    circle(400,40,5);
    outtextxy(410,40,"YI¦IN");
    circle(400,60,5);
    outtextxy(410,60,"KUYRUK");
    circle(400,80,5);
    outtextxy(410,80,"POSTFIX,PREFIX,INFIX");
    getch();
    }

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    When you push a new item, draw a circle or something above the last circle to simulate insertion into a stack or queue. When you pop or dequeue, remove the appropriate geometry. We really can't tell you how to do this since it's your program and we have no idea what you need it to do.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    10

    Problem

    Firstly i must select from right corner is it stack operation, queue operation or infix,prefix op.
    For example After selection STACK: At the center of the screen there must be an one dimensional array. User must enter some inputs (1,32,34,232,45...) and outputs (1,34,221,55,24) Then we will push these inputs to the array with animation. After that, look the output and pop if the output's item is in the list... HOW?

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >HOW?
    That's a loaded question if I ever saw one. I get the feeling that you have no idea how to create a GUI interface, much less the graphics necessary to draw a data structure on the screen. Perhaps you should wander over to planet-source-code or sourceforge and find a program that performs similar graphical operations. You can see how others did it and emulate them. I can guarantee that you are asking for a bit much here seeing as how graphics programming is not trivial or compact and you haven't given us any code that shows you've tried anything beyond printing text in graphics mode.
    My best code is written with the delete key.

  5. #5
    Registered User
    Join Date
    Oct 2003
    Posts
    10

    NO

    No, no...
    I know Turbo C's graphical functions
    but
    i
    don't know
    how to
    combine
    graphical interface
    and my functions.
    I want to say that how can i convert a rectangle on the screen to a clickable button?
    then when i click it it must make some options. Like Builder's TButton..

  6. #6
    Registered User
    Join Date
    Oct 2003
    Posts
    10

    Buttons in turbo C

    How can i activate buttons in turbo c?
    i draw some circles and i want them to be buttons. and when i clicked on them they must do some options like in C++ builder's Tbutton control...

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well since C++ builder creates windows programs, creating buttons is a bit of a freebie which comes with the environment in which you're programming.

    Turbo-C is an ancient DOS compiler with no knowledge of buttons or any other GUI facilities. You pretty much have to do everything yourself.

    PS
    Threads merged
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    but
    i
    don't know
    how to
    combine
    graphical interface
    and my functions.
    Embedding
    newlines
    in
    your
    explanation
    doesn't help
    because we already
    knew
    what
    you meant,
    moron

    If you know Turbo C's graphical functions, you should be well aware that you have to manually control everything, which includes clickable regions.

    >they must do some options like in C++ builder's Tbutton control...
    No, they don't. But you knew that already since you know Turbo C's graphical functions. Maybe you should use C++ builder instead?
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Fixing my program
    By Mcwaffle in forum C Programming
    Replies: 5
    Last Post: 11-05-2008, 03:55 AM
  3. stack and pointer problem
    By ramaadhitia in forum C Programming
    Replies: 2
    Last Post: 09-11-2006, 11:41 PM
  4. Question about a stack using array of pointers
    By Ricochet in forum C++ Programming
    Replies: 6
    Last Post: 11-17-2003, 10:12 PM
  5. error trying to compile stack program
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-03-2003, 06:27 PM