Problem with the ")" at the end of "input.

This is a discussion on Problem with the ")" at the end of "input. within the C Programming forums, part of the General Programming Boards category; Hi, I am making a program that recognises handwriting, and when i try to compile it, i get this message: ...

  1. #1
    Registered User yann's Avatar
    Join Date
    Sep 2009
    Location
    Zagreb, Croatia
    Posts
    186

    Question Problem with the ")" at the end of "input.

    Hi, I am making a program that recognises handwriting, and when i try to compile it, i get this message:
    Code:
    com.c:21: error: expected ‘)’ before ‘input’
    com.c: In function ‘main’:
    com.c:139: error: expected ‘)’ before ‘input’
    So, the actual purpose of the program isn't important...I didn't actually even come to handwriting part, here's the code...
    Code:
    #include <stdbool.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    
    float weight[100];
    bool percept[100];
    int input[100];
    
    float threshold = 0.5f;
    int successive_right = 0;
    int total_go_round = 1;
    const float learning_rate = 0.1f;
    
    bool target(int x, int y, int z) { //što ucimo perceptron
        //x je bias, pa se ne ubraja
        return (y||z); //funkcija koju ucimo perceptron
    }
    int educate() {
      
            bool goal = target(input[0], input[1], input[2]);
            percept[0] = (weight[0]*input[0]+weight[1]*input[1]+weight[2]*input[2]+weight[3]*input[3]+weight[4]*input[4]+weight [5]*input[5]+weight[6]*input[6]+weight[7]*input[7]+weight[8]*input[8]+weight[9]*input[9]+weight[10]*input[10]+weight[11]*input[11]+weight[12]*input[12]+weight[13]*input[13]+weight[14]*input[14]+weight[15]*input[15]+weight[16]*input[16]+weight[17]*input[17]+weight[18]*input[18]+weight[19]*input[19]+weight[20]*input[20]+weight[21]*input[21]+weight[22]*input[22]+weight[23]*input[23]+weight[24]*input[24]+weight[25]*input[25]+weight[26]*input[26]+weight[27]*input[27]+weight[28]*input[28]+weight[29]*input[29]+weight[30]*input[30]+weight[31]*input[31]+weight[32]*input[32]+weight[33]*input[33]+weight[34]*input[34]+weight[35]*input[35]+weight[36]*input[36]+weight[37]*input[37]+weight[38]*input[38]+weight[39]*input[39]+weight[40]*input[40]+weight[41]input[41]+weight[42]*input[42]+weight[43]*input[43]+weight[44]*input[44]+weight[45]*input[45]+weight[46]*input[46]+weight[47]*input[47]+weight[48]*input[48]+weight[49]*input[49]+weight[50]*input[50]+weight[51]*input[51]+weight[52]*input[52]+weight[53]*input[53]+weight[54]*input[54]+weight[55]*input[55]+weight[56]*input[56]+weight[57]*input[57]+weight[58]*input[58]+weight[59]*input[59]+weight[60]*input[60]+weight[61]*input[61]+weight[62]*input[62]+weight[63]*input[63]+weight[64]*input[64]+weight[65]*input[65]+weight[66]*input[66]+weight[67]*input[67]+weight[68]*input[68]+weight[69]*input[69]+weight[70]*input[70]+weight[71]*input[71]+weight[72]*input[72]+weight[73]*input[73]+weight[74]*input[74]+weight[75]*input[75]+weight[76]*input[76]+weight[77]*input[77]+weight[78]*input[78]+weight[79]*input[79]+weight[80]*input[80]+weight[81]*input[81]+weight[82]*input[82]+weight[83]*input[83]+weight[84]*input[84]+weight[85]*input[85]+weight[86]*input[86]+weight[87]*input[87]+weight[88]*input[88]+weight[89]*input[89]+weight[90]*input[90]+weight[91]*input[91]+weight[92]*input[92]+weight[93]*input[93]+weight[94]*input[94]+weight[95]*input[95]+weight[96]*input[96]+weight[97]*input[97]+weight[98]*input[98]+weight[99]*input[99]) > threshold;
            if (percept[0] == goal) {
                successive_right++;
            } else {
                successive_right = 0;
                int sign = goal ? 1 : -1; //sign of (y-f(x))
                weight[0] += learning_rate*sign*input[0];
                weight[1] += learning_rate*sign*input[1];
                weight[2] += learning_rate*sign*input[2];
                weight[3] += learning_rate*sign*input[3];
                weight[4] += learning_rate*sign*input[4];
                weight[5] += learning_rate*sign*input[5];
                weight[6] += learning_rate*sign*input[6];
                weight[7] += learning_rate*sign*input[7];
                weight[8] += learning_rate*sign*input[8];
                weight[9] += learning_rate*sign*input[9];
                weight[10] += learning_rate*sign*input[10];
                weight[11] += learning_rate*sign*input[11];
                weight[12] += learning_rate*sign*input[12];
                weight[13] += learning_rate*sign*input[13];
                weight[14] += learning_rate*sign*input[14];
                weight[15] += learning_rate*sign*input[15];
                weight[16] += learning_rate*sign*input[16];
                weight[17] += learning_rate*sign*input[17];
                weight[18] += learning_rate*sign*input[18];
                weight[19] += learning_rate*sign*input[19];
                weight[20] += learning_rate*sign*input[20];
                weight[21] += learning_rate*sign*input[21];
                weight[22] += learning_rate*sign*input[22];
                weight[23] += learning_rate*sign*input[23];
                weight[24] += learning_rate*sign*input[24];
                weight[25] += learning_rate*sign*input[25];
                weight[26] += learning_rate*sign*input[26];
                weight[27] += learning_rate*sign*input[27];
                weight[28] += learning_rate*sign*input[28];
                weight[29] += learning_rate*sign*input[29];
                weight[30] += learning_rate*sign*input[30];
                weight[31] += learning_rate*sign*input[31];
                weight[32] += learning_rate*sign*input[32];
                weight[33] += learning_rate*sign*input[33];
                weight[34] += learning_rate*sign*input[34];
                weight[35] += learning_rate*sign*input[35];
                weight[36] += learning_rate*sign*input[36];
                weight[37] += learning_rate*sign*input[37];
                weight[38] += learning_rate*sign*input[38];
                weight[39] += learning_rate*sign*input[39];
                weight[40] += learning_rate*sign*input[40];
                weight[41] += learning_rate*sign*input[41];
                weight[42] += learning_rate*sign*input[42]; 
                weight[43] += learning_rate*sign*input[43];
                weight[44] += learning_rate*sign*input[44];
                weight[45] += learning_rate*sign*input[45];
                weight[46] += learning_rate*sign*input[46];
                weight[47] += learning_rate*sign*input[47];
                weight[48] += learning_rate*sign*input[48];
                weight[49] += learning_rate*sign*input[49];
                weight[50] += learning_rate*sign*input[50];
                weight[51] += learning_rate*sign*input[51];
                weight[52] += learning_rate*sign*input[52];
                weight[53] += learning_rate*sign*input[53];
                weight[54] += learning_rate*sign*input[54];
                weight[55] += learning_rate*sign*input[55];
                weight[56] += learning_rate*sign*input[56];
                weight[57] += learning_rate*sign*input[57];
                weight[58] += learning_rate*sign*input[58];
                weight[59] += learning_rate*sign*input[59];
                weight[60] += learning_rate*sign*input[60];
                weight[61] += learning_rate*sign*input[61];
                weight[62] += learning_rate*sign*input[62];
                weight[63] += learning_rate*sign*input[63];
                weight[64] += learning_rate*sign*input[64];
                weight[65] += learning_rate*sign*input[65];
                weight[66] += learning_rate*sign*input[66];
                weight[67] += learning_rate*sign*input[67];
                weight[68] += learning_rate*sign*input[68];
                weight[69] += learning_rate*sign*input[69];
                weight[70] += learning_rate*sign*input[70];
                weight[71] += learning_rate*sign*input[71];
                weight[72] += learning_rate*sign*input[72];
                weight[73] += learning_rate*sign*input[73];
                weight[74] += learning_rate*sign*input[74];
                weight[75] += learning_rate*sign*input[75];
                weight[76] += learning_rate*sign*input[76];
                weight[77] += learning_rate*sign*input[77];
                weight[78] += learning_rate*sign*input[78];
                weight[79] += learning_rate*sign*input[79];
                weight[80] += learning_rate*sign*input[80];
                weight[81] += learning_rate*sign*input[81];
                weight[82] += learning_rate*sign*input[82];
                weight[83] += learning_rate*sign*input[83];
                weight[84] += learning_rate*sign*input[84];
                weight[85] += learning_rate*sign*input[85];
                weight[86] += learning_rate*sign*input[86];
                weight[87] += learning_rate*sign*input[87];
                weight[88] += learning_rate*sign*input[88];
                weight[89] += learning_rate*sign*input[89];
                weight[90] += learning_rate*sign*input[90];
                weight[91] += learning_rate*sign*input[91];
                weight[92] += learning_rate*sign*input[92];
                weight[93] += learning_rate*sign*input[93];
                weight[94] += learning_rate*sign*input[94];
                weight[95] += learning_rate*sign*input[95];
                weight[96] += learning_rate*sign*input[96];
                weight[97] += learning_rate*sign*input[97];
                weight[98] += learning_rate*sign*input[98];
                weight[99] += learning_rate*sign*input[99];
                
            }
        printf("%d", percept[0]);
        return;
    }
    
    int main(){
       srand(time(NULL));
       while(total_go_round <= 1575){
          educate();
          total_go_round++;
    }
       percept[0] =  (weight[0]*input[0]+weight[1]*input[1]+weight[2]*input[2]+weight[3]*input[3]+weight[4]*input[4]+weight [5]*input[5]+weight[6]*input[6]+weight[7]*input[7]+weight[8]*input[8]+weight[9]*input[9]+weight[10]*input[10]+weight[11]*input[11]+weight[12]*input[12]+weight[13]*input[13]+weight[14]*input[14]+weight[15]*input[15]+weight[16]*input[16]+weight[17]*input[17]+weight[18]*input[18]+weight[19]*input[19]+weight[20]*input[20]+weight[21]*input[21]+weight[22]*input[22]+weight[23]*input[23]+weight[24]*input[24]+weight[25]*input[25]+weight[26]*input[26]+weight[27]*input[27]+weight[28]*input[28]+weight[29]*input[29]+weight[30]*input[30]+weight[31]*input[31]+weight[32]*input[32]+weight[33]*input[33]+weight[34]*input[34]+weight[35]*input[35]+weight[36]*input[36]+weight[37]*input[37]+weight[38]*input[38]+weight[39]*input[39]+weight[40]*input[40]+weight[41]input[41]+weight[42]*input[42]+weight[43]*input[43]+weight[44]*input[44]+weight[45]*input[45]+weight[46]*input[46]+weight[47]*input[47]+weight[48]*input[48]+weight[49]*input[49]+weight[50]*input[50]+weight[51]*input[51]+weight[52]*input[52]+weight[53]*input[53]+weight[54]*input[54]+weight[55]*input[55]+weight[56]*input[56]+weight[57]*input[57]+weight[58]*input[58]+weight[59]*input[59]+weight[60]*input[60]+weight[61]*input[61]+weight[62]*input[62]+weight[63]*input[63]+weight[64]*input[64]+weight[65]*input[65]+weight[66]*input[66]+weight[67]*input[67]+weight[68]*input[68]+weight[69]*input[69]+weight[70]*input[70]+weight[71]*input[71]+weight[72]*input[72]+weight[73]*input[73]+weight[74]*input[74]+weight[75]*input[75]+weight[76]*input[76]+weight[77]*input[77]+weight[78]*input[78]+weight[79]*input[79]+weight[80]*input[80]+weight[81]*input[81]+weight[82]*input[82]+weight[83]*input[83]+weight[84]*input[84]+weight[85]*input[85]+weight[86]*input[86]+weight[87]*input[87]+weight[88]*input[88]+weight[89]*input[89]+weight[90]*input[90]+weight[91]*input[91]+weight[92]*input[92]+weight[93]*input[93]+weight[94]*input[94]+weight[95]*input[95]+weight[96]*input[96]+weight[97]*input[97]+weight[98]*input[98]+weight[99]*input[99]) > threshold;
       printf("perceptron: ");
       printf("%d\n", percept[0]);
    return 0;
    }
    Do you know where the problem is? I think it is somewhere here...
    Code:
    (weight[0]*input[0]+weight[1]*input[1]+weight[2]*input[2]+weight[3]*input[3]+weight[4]*input[4]+weight [5]*input[5]+weight[6]*input[6]+weight[7]*input[7]+weight[8]*input[8]+weight[9]*input[9]+weight[10]*input[10]+weight[11]*input[11]+weight[12]*input[12]+weight[13]*input[13]+weight[14]*input[14]+weight[15]*input[15]+weight[16]*input[16]+weight[17]*input[17]+weight[18]*input[18]+weight[19]*input[19]+weight[20]*input[20]+weight[21]*input[21]+weight[22]*input[22]+weight[23]*input[23]+weight[24]*input[24]+weight[25]*input[25]+weight[26]*input[26]+weight[27]*input[27]+weight[28]*input[28]+weight[29]*input[29]+weight[30]*input[30]+weight[31]*input[31]+weight[32]*input[32]+weight[33]*input[33]+weight[34]*input[34]+weight[35]*input[35]+weight[36]*input[36]+weight[37]*input[37]+weight[38]*input[38]+weight[39]*input[39]+weight[40]*input[40]+weight[41]input[41]+weight[42]*input[42]+weight[43]*input[43]+weight[44]*input[44]+weight[45]*input[45]+weight[46]*input[46]+weight[47]*input[47]+weight[48]*input[48]+weight[49]*input[49]+weight[50]*input[50]+weight[51]*input[51]+weight[52]*input[52]+weight[53]*input[53]+weight[54]*input[54]+weight[55]*input[55]+weight[56]*input[56]+weight[57]*input[57]+weight[58]*input[58]+weight[59]*input[59]+weight[60]*input[60]+weight[61]*input[61]+weight[62]*input[62]+weight[63]*input[63]+weight[64]*input[64]+weight[65]*input[65]+weight[66]*input[66]+weight[67]*input[67]+weight[68]*input[68]+weight[69]*input[69]+weight[70]*input[70]+weight[71]*input[71]+weight[72]*input[72]+weight[73]*input[73]+weight[74]*input[74]+weight[75]*input[75]+weight[76]*input[76]+weight[77]*input[77]+weight[78]*input[78]+weight[79]*input[79]+weight[80]*input[80]+weight[81]*input[81]+weight[82]*input[82]+weight[83]*input[83]+weight[84]*input[84]+weight[85]*input[85]+weight[86]*input[86]+weight[87]*input[87]+weight[88]*input[88]+weight[89]*input[89]+weight[90]*input[90]+weight[91]*input[91]+weight[92]*input[92]+weight[93]*input[93]+weight[94]*input[94]+weight[95]*input[95]+weight[96]*input[96]+weight[97]*input[97]+weight[98]*input[98]+weight[99]*input[99]) > threshold;
    Thanks,

    yann
    Arduino rocks!

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Did you mean for this to be ==, instead:

    Code:
    int sign = goal ? 1 : -1; //sign of (y-f(x))
    In your educate function, I'd have it return an actual int. Usually, that error message means you have more ) char's you should have.

    What about using a loop to add up that *long* line of code?

    Code:
    for(i = 0; i < 100; i++)  {
       tally = weight[i] + input[i];
    }
    I don't know that that syntax is going to do anything or not:
    Code:
    variable = (lots of things added up) > threshold;  //?
    And watch your typo's: weight [5] is not weight[5].

    Congrats on the good style, makes it much easier to look through.
    Last edited by Adak; 09-25-2009 at 05:00 AM.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,648
    Quote Originally Posted by Adak
    Did you mean for this to be ==, instead:
    Not likely, since changing to == would likely result in a compile error.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User yann's Avatar
    Join Date
    Sep 2009
    Location
    Zagreb, Croatia
    Posts
    186
    Quote Originally Posted by Adak View Post
    Did you mean for this to be ==, instead:

    Code:
    int sign = goal ? 1 : -1; //sign of (y-f(x))
    In your educate function, I'd have it return an actual int. Usually, that error message means you have more ) char's you should have.

    What about using a loop to add up that *long* line of code?

    Code:
    for(i = 0; i < 100; i++)  {
       tally = weight[i] + input[i];
    }
    I don't know that that syntax is going to do anything or not:
    Code:
    variable = (lots of things added up) > threshold;  //?
    And watch your typo's: weight [5] is not weight[5].

    Congrats on the good style, makes it much easier to look through.
    thank you...i think that the for loop is going to fix it!

    PS:
    On what style do you actually mean?
    Arduino rocks!

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    It's way too late to be posting, clearly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  2. Replies: 5
    Last Post: 12-03-2003, 04:47 PM
  3. read to end of line problem
    By one1082 in forum C++ Programming
    Replies: 3
    Last Post: 11-07-2003, 03:30 PM
  4. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM
  5. Next Question...
    By Azmeos in forum C++ Programming
    Replies: 3
    Last Post: 06-06-2003, 02:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21