Finding my way around screen and please help with question

Discussion in 'C' started by James P. Devaney, Jul 8, 2009.

  1. James P. Devaney

    James P. Devaney New Member

    Joined:
    Jul 8, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hello,
    I am trying to do some programming. I'm trying to use C. Half way through a book I gave up trying to learn C++. Now I have C++ but it does take C. I have Borland C++ ver. 4.52. What about the Bloodshed code? It seems to have changed in the past few months. There is nobody there for general questions.
    Two questions:
    Here's a sample of my code:

    Code:
    #include <graphics.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <conio.h>
    #include <time.h>
    #include <dos.h>
    /*****************/
    void light1 (void);
    void r01 ( void );
     
    /****************/
     
    int main(void) {
    /* request auto detection */
    int gdriver = DETECT, gmode, errorcode;
    /* initialize graphics, local variables */
    initgraph(&gdriver, &gmode, "");
    /* read result of initialization */
    errorcode = graphresult();
    if (errorcode != grOk)
    /* an error occurred */
    {
    printf("Graphics error: %s\n", grapherrormsg(errorcode));
    printf("Press any key to halt:");
    getch();
    exit(1); /* terminate with an error code */
    }
    /***************************************************************/
    /* Make a box */
    setbkcolor(LIGHTBLUE);
    setcolor(6); /* brown */
    /* baselin1(); */ 
    setrvlr1(); 
    light1(); 
    sound1(); 
    getch();
     
    void r01 ( void ) {
    int i = 0;
    for (i=1; i<478; i++) {
    setcolor (13);
    line ( 636, 5 + i, 636, i);
    delay(NUMDEL1);
    setcolor (11);
    line ( 635, i + 1, 635, i + 1);
    }
    setcolor (13);
    }
    }
    /**************************/
    There is code there that you probably don't like. The "request auto detection " and the initgraph stuff. But see the last stuff so lines can be drawn like "line ( 636, 5 + i, 636, i);". I'm drawing lines the old way. Is there a new way without that stuff?

    Secondly, I know from some years as tech support, fifteen years ago, that a program "The Mail Order Wizard" could be run in two ways. The people had to be careful about their drive space, not wasting it. The Wizard used to be a DOS program and could be brought up on the C:\ or D:\ or E:\ etc. by Wizard C or D or E, Etc. The program could be written in Assembler or C++.

    How do I send that letter in? Can you do it? I would like to know that.

    Thank you for your time.

    Jim Devaney
     
    Last edited by a moderator: Jul 9, 2009
  2. mayjune

    mayjune New Member

    Joined:
    Jun 14, 2009
    Messages:
    814
    Likes Received:
    33
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Pune,Delhi
    as for your first problem, that is the best way, there are other ways dda line, bresenham line but then you would have to code the whole code for it to draw a line...so this old way is better i would say

    ps - don't know why no one notices but we never give any value to gmode variable...
    you can replace &gmode with NULL in initgraph(), it works for me in TC, try it in your compiler.
    Also instead of DETECT, you can give value 0 too, as its the same thing..
     
  3. James P. Devaney

    James P. Devaney New Member

    Joined:
    Jul 8, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hello,
    What about the argument "Wizard C (or D or E)" to tell the PC which drive to try for orders? It's stored in the settings in Assembler or C++. Can you give me an example please?
    Thank you.
    Jim Devaney
     
  4. mayjune

    mayjune New Member

    Joined:
    Jun 14, 2009
    Messages:
    814
    Likes Received:
    33
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Pune,Delhi
    i have no idea what this Wizard C is... nor what your question is...
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice