class Timerange{
public:
Start_time start;
End_time end;
Timerange(string initstring){
//initstring xx:xx X, x:x
//X->weekday
string current="";
unsigned short mode=0;
string timeA;
string weekday;
string timeB;
for(unsigned short i = 0; i<initstring.length(); i++) {
char c = initstring[i];
if (c==' '){
if (mode==0)
timeA = current;
else if (mode==1)
weekday = current;
else if (mode==2)
timeB = current;
mode++;
current ="";
};
else{ //here
current+=c;
};
};
};
};
it gives me error: 'else' without previous 'if''
but there is an if! What's going on?