int entryMemory(int memory[])
{
    int accumulator = 0, code = 0, instructionCounter = 0;
    while(instructionCounter < SIZEOFMEMORY)
    {
        printf("%02d? ", instructionCounter);
        do
        {
            scanf("%d", &accumulator);
            code = abs(accumulator / 100);
            if(accumulator == -99999)
            {
                printf("*** Loading the program is done. ***\n"
                       "*** Starting to run the program. ***");
                universalSleep(2.5);
                universalClear();
                return 0;
            }
            else if(accumulator >= -9999 && accumulator <= 9999)
            {
                memory[instructionCounter] = accumulator;
            }
        }while((accumulator != - 99999 && accumulator < -9999) || accumulator > 9999);
        if(code == 0 || code == 10 || code == 11 || code == 20 || code == 21 || code == 22 ||
           code == 23 || code == 24 || code == 25 || code == 26 || code == 27 ||
           code == 30 || code == 31 || code == 32 || code == 33 || code == 34 ||
           code == 40 || code == 41 || code == 42 || code == 43 || code == 44 || code == 45)
        {
            ++instructionCounter;
        }
    }
    printf("*** The memory is full. ***\n");
    exit(1);
}
Exemplo n.º 2
0
int main()
{
    int position=0, adding=1;
    double M_PI=acos(-1.0);
    while (1)
    {
        for (int i=0; i<position;++i)
        {
            printf (" ");
        }
        printf ("#\n\n");
        universalSleep(1.0/(4*sin(2.0*M_PI*position/39)+4.5));
        universalClerar();
        if (position<0||position>=40)
        {
            adding=-adding;
        }
        position+=adding;
    }
    return 0;
}
Exemplo n.º 3
0
int main()
{
    int n=1000,position=0,adding=1;
    while (n)
    {
       for (int i=0;i<position; ++i)
       {
           printf(" ");
       }
       printf ("#\n");
       universalSleep(0.4);
       universalClear();

       if (position<0 || position>=40)
       {
           adding=-adding;
       }
       position+=adding;
       --n;
    }
    return 0;
}
Exemplo n.º 4
0
int main()
{
    int position=0;
    int adding=1;
    double M_PI=3.14;
    while(1){
        for(int i=0;i<position;i++)
        {
            printf(" ");
        }
        printf("#\n\n");
        universalSleep(1.0/(sin(2* M_PI*position/39)+4.5));
        universalClear();
        if(position<0||position>=40){
            adding=-adding;
        }
        position+=adding;

        }



    return 0;
}