1번
~cpp
#include <iostream>
using namespace std;
bool team684(int member, int gun, int boat);
int main(void)
{
int member, gun, boat;
cin >> member;
cin >> gun;
cin >> boat;
team684(member, gun, boat);
return 0;
}
bool team684(int member, int gun, int boat)
{
if (member >= 3 && gun >= 2 && boat >= 1) {
cout << "success";
} else {
cout << "fail";
}
return 0;
}
2번
~cpp
#include <iostream>
#include <time.h>
using namespace std;
int dice();
int main(void)
{
srand((unsigned)time(NULL));
cout << dice();
return 0;
}
int dice()
{
return rand()%6 + 1;
}
3번
~cpp
#include <iostream>
using namespace std;
void s1();
void s2();
void s3();
void s4();
void s5();
void s6();
void s7();
void prin();
void main(void)
{
s1();
}
void s1()
{
cout << "1" << endl;
s2();
s3();
s4();
s5();
s6();
s7();
}
void s2()
{
cout << "2" << endl;
s3();
s4();
s5();
s6();
s7();
}
void s3()
{
cout << "3" << endl;
s4();
s5();
s6();
s7();
}
void s4()
{
cout << "4" << endl;
s5();
s6();
s7();
}
void s5()
{
s6();
s7();
cout << "5" << endl;
}
void s6()
{
cout << "6" << endl;
s7();
}
void s7()
{
cout << "7" << endl;
prin();
}
void prin()
{
cout << "공주" << endl;
}