Why won't this compile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
void functionadd(){
     int size = 50;
     
     int iarray[size];
     
     int number;
     
     int total;
     
     for(int i=0; i<size; i++){
    if(iarray[i]!=0 && iarray[i+1]!=0)
    break;
    
    else{
     cout<< "Enter a number to add \n"
     cin >> number;
     iarray[i]= number;
     }}
     
     for(int i=0; i<50 ; i++){
             if(iarray[i]==0 && iarray[i+1]==0)
     break;
     else{
          for(int s=0; s<size; s++)
                  total += iarray[s];
                  }
                  }
                  
                  cout <<"The total is : " <<total<<endl;
                  
     
     }

Usually the compiler gives you errors telling exactly this. Have you tried compiling it yourself?
Yes, but Dev C++ Bloodshed doesnt give me any details just says, [BUILD ERROR] ERROR 1.
Last edited on
it lacks an ; after the cout in line 15
I spent atleast a half and hour re reading this over and over again. Because it couldn't compile. Thanks alot.
Topic archived. No new replies allowed.