본문내용
, count = 0;
int temp = 0;
srand(time(NULL));
cout<<"고객이 서비스 받는 시간 : ";
for(int i = 0;i < 5; i++){
temp = rand()%30+1;
ready.push(temp);
cout<
}
cout<
cout<<"고객이 들어온 시간 : ";
for(i = 0;i < 5; i++){
temp = rand()%10+1;
client.push(temp);
cout<
}
cout<
count = client.size();
for(i = 0;i < 5; i++){
totalready = totalready + ready.front() - client.front();
ready.pop();
client.pop();
}
ave = totalready/count;
cout<<"고객의 평균 대기 시간 : "<
return 0;
}
7. 철수와 영희가 자신들의 친구들을 결혼식에 초대하고자 한다.
#include
#include
#include
#include
#include
using namespace std;
int main()
{
vector chulsu;
vector younghee;
vector invite(10);
chulsu.push_back("CSK");
chulsu.push_back("BHJ");
chulsu.push_back("RDJ");
younghee.push_back("CSK");
younghee.push_back("LYD");
younghee.push_back("BHJ");
younghee.push_back("SJW");
sort(chulsu.begin(),chulsu.end(), less());
sort(younghee.begin(),younghee.end(), less());
cout<<"철수 친구 : ";
for(int i=0; i< chulsu.size(); i++)
cout<< chulsu[i] <<" ";
cout<
cout<<"영희 친구 : ";
for(int j=0; j < younghee.size(); j++)
cout<< younghee[j] <<" ";
cout<
copy(chulsu.begin(), chulsu.end(), invite.begin());
copy(younghee.begin(), younghee.end(), invite.begin()+i);
cout<<"철희와 영수친구 합 : ";
for(j=0; j < invite.size(); j++)
cout<< invite[j] <<" ";
cout<
vector::iterator it;
for(j=0; j < invite.size(); j++)
{
int n = count(invite.begin(),invite.end(), invite[j]);
if(n >= 2)
{
it = remove(invite.begin(), invite.end(), invite[j]);
invite.erase(it, invite.end());
}
}
sort(invite.begin(), invite.end(), less());
cout<<"철희와 영수친구 합(중복제거): ";
for(j=0; j < invite.size(); j++)
cout<< invite[j] <<" ";
cout<
return 0;
}
int temp = 0;
srand(time(NULL));
cout<<"고객이 서비스 받는 시간 : ";
for(int i = 0;i < 5; i++){
temp = rand()%30+1;
ready.push(temp);
cout<
cout<
for(i = 0;i < 5; i++){
temp = rand()%10+1;
client.push(temp);
cout<
cout<
for(i = 0;i < 5; i++){
totalready = totalready + ready.front() - client.front();
ready.pop();
client.pop();
}
ave = totalready/count;
cout<<"고객의 평균 대기 시간 : "<
}
7. 철수와 영희가 자신들의 친구들을 결혼식에 초대하고자 한다.
#include
#include
#include
#include
#include
using namespace std;
int main()
{
vector
vector
vector
chulsu.push_back("CSK");
chulsu.push_back("BHJ");
chulsu.push_back("RDJ");
younghee.push_back("CSK");
younghee.push_back("LYD");
younghee.push_back("BHJ");
younghee.push_back("SJW");
sort(chulsu.begin(),chulsu.end(), less
sort(younghee.begin(),younghee.end(), less
cout<<"철수 친구 : ";
for(int i=0; i< chulsu.size(); i++)
cout<< chulsu[i] <<" ";
cout<
for(int j=0; j < younghee.size(); j++)
cout<< younghee[j] <<" ";
cout<
copy(younghee.begin(), younghee.end(), invite.begin()+i);
cout<<"철희와 영수친구 합 : ";
for(j=0; j < invite.size(); j++)
cout<< invite[j] <<" ";
cout<
for(j=0; j < invite.size(); j++)
{
int n = count(invite.begin(),invite.end(), invite[j]);
if(n >= 2)
{
it = remove(invite.begin(), invite.end(), invite[j]);
invite.erase(it, invite.end());
}
}
sort(invite.begin(), invite.end(), less
cout<<"철희와 영수친구 합(중복제거): ";
for(j=0; j < invite.size(); j++)
cout<< invite[j] <<" ";
cout<
}
소개글