Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ifstream workData(workSample) ;
- {
- while(!workData.eof())
- {
- workNum++ ;
- getline(workData , shipName , ',') ;
- if(shipName.size() == 0)
- {
- cout << "bad " ;
- answer[workNum] = -1 ;
- badDataCount++ ;
- continue ;
- }
- getline(workData , start , ',') ;
- if(start.size() == 0)
- {
- cout << "bad " ;
- answer[workNum] = -1 ;
- badDataCount++ ;
- continue ;
- }
- else if(start.size() != 0)
- {
- startTime = 600 * (start[0] - 48) + 60 * (start[1] - 48) + 10 * (start[3] - 48) + (start[4] - 48) ;
- }
- if(startTime <= 360 || startTime >= 1080)
- night = 1 ;
- else if(startTime > 360 && startTime < 1080)
- night = 0 ;
- getline(workData , type , ',') ;
- if(type.size() == 0)
- {
- cout << "bad " ;
- answer[workNum] = -1 ;
- badDataCount++ ;
- continue ;
- }
- getline(workData , fir , ',') ;
- if(fir.size() == 0)
- {
- cout << "bad " ;
- answer[workNum] = -1 ;
- badDataCount++ ;
- continue ;
- }
- else if(fir.size() != 0)
- first = atoi(fir.c_str() ) ;
- workData >> sec ;
- workData.ignore() ;
- if(sec.size() == 0)
- {
- cout << "bad " ;
- answer[workNum] = -1 ;
- badDataCount++ ;
- continue ;
- }
- else if(sec.size() != 0)
- second = atoi(sec.c_str() ) ;
- if(answer[workNum] != -1)
- {
- cout << shipName << " " << startTime << " " << type << " " << first << " " << second << endl ;
- workingData[workNum] = new Work(shipName , night , type , first , second) ;
- if(type == "I")
- inNum++ ;
- else if(type == "O")
- outNum++ ;
- else if(type == "T")
- transNum++ ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement