{{{~cpp #include #include #include #include //setprecision #include //precision using namespace std; const BUS_NO = 7; class cbus { public: void change_speed(const int n) { speed=n; } float buspos(const int min,const int lanelen) { float hour = ((float)min)/60.0; float pos; pos = hour * speed; while(pos>=lanelen) pos-=lanelen; return pos; } private: int speed; }; int main() { ifstream fin("input.txt"); vector vbus; cbus tmpclass; int lanelen,i; //버스노선 길이와 버스 속도 구하기 fin >> lanelen; //버스노선 길이 for(i=1;i<=BUS_NO;++i) { //버스 속도 int tmpint; fin >> tmpint; tmpclass.change_speed(tmpint); vbus.push_back(tmpclass); } int min; int hour; cout << "몇시간 후의 버스 위치를 보시겠습니까?" << endl << "시간 : "; cin >> hour; cout << "분 : "; cin >> min; for(vector::iterator j=vbus.begin();jbuspos(min+hour*60,lanelen) << " km" << endl; cout << setprecision(pre); } return 0; } }}}