示例#1
0
int main()
{
    char array [mas_str][mas_col];
    char element='#',xin='x';
    int str=3,col=3,swi=1,counter=0,c_1,c_2;
    two_dimensional_array_input_elements (array,str,col,element);
    two_dimensional_array_output (array,str,col);
    printf("\n\n");
    printf("\n");
    while (swi)
    {
     scanf ("%d",&c_1);
     scanf ("%d",&c_2);
     two_dimensional_array_input_one_element_char(array,c_1,c_2,xin);
     ++counter;
     universalClear();
     two_dimensional_array_output (array,str,col);
     system ("pause");
     if (check_win_x0 (array,str,col)==1)
     {
        printf("You win!\n");
        system ("pause");
        return 1;
     }
     if (counter==9)
     {
         printf("draw...\n");
         system ("pause");
         exit (1);
     }
     two_dimensional_array_x0_reaction (array,str,col);
     universalClear();
     ++counter;
     two_dimensional_array_output (array,str,col);
     system ("pause");
     if (check_win_x0 (array,str,col)==0)
     {
        printf("You lose!\n");
        system ("pause");
        return 1;
     }
     if (counter==9)
     {
         printf("draw...\n");
         system ("pause");
         exit (1);
     }
    }
    return 0;
}
示例#2
0
int main()
{
    int mass[N];
    int size,userNumberSrch;
    printf("vvedite razmer massiva:");
    scanf("%d",&size);
    universalClear();
    arr_in(mass,size);
    universalClear();
    arr_out(mass,size);
    printf("vvedite chislo dlia poiska :");
    scanf("%d",&userNumberSrch);
    srch(mass,size,userNumberSrch);
    return 0;
}
示例#3
0
int programmEnter(int *arrayTempMemoryProgramm)
{
    int numberCommandLine=0,tempCommand;
    printf("\ngo govnokodit'\n");
    do
    {
        printf("%02d::",numberCommandLine);
        scanf("%d",&tempCommand);
        if(tempCommand!=-9999&&(tempCommand<9999&&tempCommand>-9999))
        {
            arrayTempMemoryProgramm[numberCommandLine]=tempCommand;
        }
        else if(tempCommand==-9999)
        {
            printf("you enter -99999 \nthe end\n...............");
            universalClear();
            return 0;
        }
        else
        {
            numberCommandLine--;
            printf("error command line\n");
        }
    }
    while(++numberCommandLine<=100);
    printf("memory is full \nupgrade your virtual machine");
    return 1;
}
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);
}
示例#5
0
int main()
{
    int array[SIZE];
    int number;
    printf("Fill the array with %d elements.\n", SIZE);
    inputArray(array, SIZE);
    universalClear();
    printf("Your array: ");
    outputArrray(array, SIZE);
    printf("Enter the number: ");
    scanf("%d", &number);
    printf("%d", arraySearch(number, array, SIZE));

    return 0;
}
示例#6
0
int main()
{
    int array[SIZE], sizeOfPart, maxElement, minElement;
    printf("Enter the size of array (0 < size <= %d): ", SIZE);
    scanf("%d", &sizeOfPart);
    askForGenerateOrWriting(array, sizeOfPart);
    universalClear();
    printf("Your array:\n");
    outputArrray(array, sizeOfPart);
    maxElement = maxOfArray(array, sizeOfPart);
    minElement = minOfArray(array, sizeOfPart);
    for(int i = 0; i < sizeOfPart; ++i)
    {
        array[i] = array[i] % 2? minElement : maxElement;
    }
    printf("New array:\n");
    outputArrray(array, sizeOfPart);
    return 0;
}
示例#7
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;
}
示例#8
0
int main()

{
    int hh1, hh2, hh3;
    int mm1, mm2, mm3;
    int ss1, ss2, ss3;
    printf("Write down the first timepoint: ");
    printf("Enter hours: ");
    scanf("%d", &hh1);
    printf("Enter minutes: ");
    scanf("%d", &mm1);
    printf("Enter seconds: ");
    scanf("%d", &ss1);

    printf("Write down the second timepoint: ");
    printf("Enter hours: ");
    scanf("%d", &hh2);
    printf("Enter minutes: ");
    scanf("%d", &mm2);
    printf("Enter seconds: ");
    scanf("%d", &ss2);

    printf("Write down the third timepoint: ");
    printf("Enter hours: ");
    scanf("%d", &hh3);
    printf("Enter minutes: ");
    scanf("%d", &mm3);
    printf("Enter seconds: ");
    scanf("%d", &ss3);

    universalClear();
	printf("%02d:%02d:%02d\n", hh1, mm1, ss1);
	printf("%02d:%02d:%02d\n", hh2, mm2, ss2);
	printf("%02d:%02d:%02d\n", hh3, mm3, ss3);

	return 0;
}
示例#9
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;
}