помогите откомпилировать

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by Student :), 12 Jun 2011.

  1. Student :)

    Student :) Elder - Старейшина

    Joined:
    9 Feb 2007
    Messages:
    278
    Likes Received:
    18
    Reputations:
    -15
    #include <conio.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <malloc.h>

    #define SCANCODE_ONE 49
    #define SCANCODE_ZERO 48

    typedef unsigned short us;
    typedef unsigned char uc;
    typedef unsigned long ul;

    typedef struct
    {
    ul zero;
    ul one;
    } datatype;


    // запрос символа с клавы
    uc getnum(void)
    {
    uc j, k=0;
    while ( !kbhit() );
    while ( !k )
    k = getch();
    j=255;
    if ( k == SCANCODE_ONE )
    j=1;
    if ( k == SCANCODE_ZERO )
    j=0;
    return j;
    }


    void updatedata(datatype **data, uc *ans, uc depth)
    {
    int i, k;
    ul j;
    for ( i=(depth-1); i>=0; i-- ) {
    j=0;
    for ( k=(depth-1); k>=i; k-- )
    j += ans[k] * (1<<(depth-1-k));
    if ( ans[depth] == 1)
    data[depth-1-i][j].one++;
    if ( ans[depth] == 0)
    data[depth-1-i][j].zero++;
    }
    }


    uc analyse(datatype **data, uc *ans, uc depth)
    {
    int i, k;
    ul j, zero=0, one=0;

    for ( i=(depth-1); i>=0; i-- ) {
    j=0;
    for ( k=(depth-1); k>=i; k-- )
    j += ans[k] * (1<<(depth-1-k));
    one += data[depth-1-i][j].one;
    zero += data[depth-1-i][j].zero;
    }
    if ( zero > one )
    return 0;
    else
    return 1;
    }


    void main ( void )
    {
    ul all_answer=0, wrong_answer=0;
    uc depth;
    datatype **data;
    uc *ans;
    us i;
    uc t_ans, c;

    printf("\nDepth (1..20) : "); scanf("\%d", &depth);

    ans = (uc *)calloc( depth+1, sizeof(uc *));

    if ( ((data = (datatype **)malloc( depth * sizeof(datatype *) )) == NULL) ) {
    puts("Not enough memory!");
    exit(1);
    }

    for ( i=0; i<depth; i++ )
    if ( (data = (datatype *)calloc( (1+(1<<(i+1))), sizeof(datatype) )) == NULL) {
    puts("Not enough memory!");
    exit(1);
    }

    printf("\nPress '0' or '1'.");
    printf("\nAny other key - exit.\n\n");

    while (1) {
    for ( i=0; i<depth; i++ )
    ans = ans[i+1];
    t_ans = analyse(data, ans, depth);

    if ( (ans[depth] = getnum()) == 255)
    return;

    updatedata(data, ans, depth);
    all_answer++;

    c = '+';
    if ( t_ans != ans[depth] ) {
    wrong_answer++;
    c = '-';
    }
    printf("? \%d - \%d ? \%0.3f ? \%d ? \%c ?\n", ans[depth], t_ans, (all_answer-wrong_answer)/(all_answer+1.0), all_answer, c );
    }
    }
     
  2. Student :)

    Student :) Elder - Старейшина

    Joined:
    9 Feb 2007
    Messages:
    278
    Likes Received:
    18
    Reputations:
    -15
    курсовая горююююююю (((((((
     
  3. Ins3t

    Ins3t Харьковчанин

    Joined:
    18 Jul 2009
    Messages:
    939
    Likes Received:
    429
    Reputations:
    139
    http://dl.dropbox.com/u/29025286/Different_sucks/programm.exe
     
  4. Student :)

    Student :) Elder - Старейшина

    Joined:
    9 Feb 2007
    Messages:
    278
    Likes Received:
    18
    Reputations:
    -15
    а как вы откомпилировали? и чем если не секрет, очень надо
     
  5. Wirelis

    Wirelis New Member

    Joined:
    6 Jun 2011
    Messages:
    2
    Likes Received:
    0
    Reputations:
    0
    компилятором блять :)
     
  6. Student :)

    Student :) Elder - Старейшина

    Joined:
    9 Feb 2007
    Messages:
    278
    Likes Received:
    18
    Reputations:
    -15
    а каким? у меня наверно руки растут не от туда ((((
     
  7. Ins3t

    Ins3t Харьковчанин

    Joined:
    18 Jul 2009
    Messages:
    939
    Likes Received:
    429
    Reputations:
    139
    Visual C++ 2010

    [​IMG]
     
    1 person likes this.
  8. AGENTWPC74

    AGENTWPC74 Member

    Joined:
    11 Nov 2009
    Messages:
    201
    Likes Received:
    37
    Reputations:
    5

    :D ппц
     
  9. Ins3t

    Ins3t Харьковчанин

    Joined:
    18 Jul 2009
    Messages:
    939
    Likes Received:
    429
    Reputations:
    139
    что ппц?
    я хз как еще показать, может видео-материал еще подготовить?
     
  10. AGENTWPC74

    AGENTWPC74 Member

    Joined:
    11 Nov 2009
    Messages:
    201
    Likes Received:
    37
    Reputations:
    5
    да я в том смысле что у студента не то что руки не от туда у него и голова незнама где раз кнопку нажать не смог в компиляторе
     
  11. yuran666666

    yuran666666 Member

    Joined:
    18 Jan 2009
    Messages:
    84
    Likes Received:
    19
    Reputations:
    11
    ТС->RTFM-> СХБ
     
  12. Student :)

    Student :) Elder - Старейшина

    Joined:
    9 Feb 2007
    Messages:
    278
    Likes Received:
    18
    Reputations:
    -15
    ТС->RTFM-> СХБ что это?
    а кроме VS
    есть другой норм компилятор?
     
  13. cheater_man

    cheater_man Member

    Joined:
    13 Nov 2009
    Messages:
    651
    Likes Received:
    44
    Reputations:
    7
    чувак мочит=)
    ааахаах как вы это сделали?=)