Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   C programs and a better way to get around on the screen. (http://www.go4expert.com/forums/c-programs-screen-t18430/)

James P. Devaney 9Jul2009 00:02

C programs and a better way to get around on the screen.
 
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;
    int midx, midy;
 
    /* 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(); /* Has to come after setrvlr1(); or (?) baselin1(); */
 
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? I would like to know that.

Thank you very much for your help.

Jim Devaney

SaswatPadhi 9Jul2009 06:08

Re: C programs and a better way to get around on the screen.
 
Duplicate of http://www.go4expert.com/showthread.php?p=51895.

Thread closed.


All times are GMT +5.5. The time now is 04:14.