Код: Выделить всё
# Comments
# Comments
nameOfTheMarket
timeOfSimulation
averageTime
numberOfCashiers
cashierName1 quality1 salary1
cashierName2 quality2 salary2
- - -
cashierNameN qualityN salaryN
#End
Код: Выделить всё
int main ()
{
string marketName, cashierName;
int counter = 0;
int counter2 = 0;
int simulationTime,averageTime, numberOfCashiers;
string info, test;
ifstream input("/home/meucomputador/workspace/Testezin/src/naocompre.dat");
if(input.is_open()) {
while(!input.eof()) {
getline(input,info);
cout averageTime;
break;
case 4:
stringstream(info) >> numberOfCashiers;
break;
default:
//how to read the 3 information at the same line?
for(int i = 0; i < info.length(); i++) {
while(info[i] != ' ')
counter2++;
}
cashierName = info.substr(0,counter2+1);
}
}
}
return 0;
};
Подробнее здесь: https://stackoverflow.com/questions/401 ... y-spaces-c