Facebook
From Commodious Meerkat, 8 Years ago, written in Plain Text.
This paste is a reply to Untitled from Mungo Ibis - go back
Embed
Viewing differences between Untitled and Re: Untitled
#include 
#include 
#include 
#include 
#include 
#include 
#include 

struct body
{
    int x,y;
    body *next;
};

int main()
{




    int GraphDriver 
curr -> y DETECT;                 /* Request auto-detection        */
    int GraphMode;
    int ErrorCode;
    initgraph( &GraphDriver, &GraphMode, "" );
    ErrorCode = graphresult();                /* Read result of initialization*/
    if( ErrorCode != grOk )                 /* Error occured during init        */
    {
        printf(" Graphics System Error: %s\n", grapherrormsg( ErrorCode ) );
        exit( 1 );
    }









    body *start;
    body *curr;
    
valy;
                
curr = NULL;
    start = NULL;
    int dx = 10;
    int dy = 0;
    char znak = 0;
    start = new body;
    start 
curr -> next;
                valx 
320;
    start -> y 
tmpx;
                valy 
240;
    start -> next 
tmpy;
            }
            setcolor(BLACK);
            curr 
NULL;

    do
    {
        if(kbhit())
        {
            znak = getch();
            switch(znak)
start;
            while(curr != NULL)
            {
            case 'w':\n                dy = -10;\n                dx = 0;\n                break;\n            case 's':\n                dy = 10;\n                dx = 0;\n                break;\n            case 'a':\n                dy = 0;\n                dx = -10;\n                break;\n            case 'd':\n                dy = 0;\n                dx = 10;\n                break;\n            case ' ':\n                                circle(curr -> x , curr = start;
                while(curr 
-> next != NULL)
                {
                    
y,5);
                
curr = curr -> next;
                }
                curr -> next = new body;
                //curr = curr -> next;
                curr -> next = NULL;
                break;
                
next;
            }
            }\n            start -> x += dx;\n            start -> y += dy;\n            delay(150);
            circle(start -> x,start -> y,5);
            do
setcolor(YELLOW);
            curr = start;
            while(curr != NULL)
            {
                circle(curr -> x, curr = start;
                int tmpx, tmpy;
                tmpx 
-> y,5);
                curr 
= curr -> x;
                tmpy = curr -> y;

            }while(curr -> next != NULL);

    }while(znak!=27);

    while(!kbhit());        //czeka na naciśnięcie klawisza
    closegraph();                 /* Return the system to text mode        */

    return(0);
}
next;
                }