== 성우용 ==
1번 함수만들기
~cpp
#include<iostream>
using namespace std;
bool team684(int ,int ,int);
void main()
{
int num=0,gun=0,boat=0;
team684(num,gun,boat);
}
bool team684(int num,int gun,int boat)
{
int sum;
cout<<"대원의 수를 입력하시오.";
cin >> num;
cout<<"총의 수를 입력하시오.";
cin >> gun;
cout<<"보트의 수를 입력하시오.";
cin >> boat;
sum = num + gun + boat;
if(num >= 5 && gun >= 1 ){
if(sum >= 10)
{
cout<<"성공!";
}
else
{
cout<<"실패!";
}
}
else
{
cout<<"실패!";
}
return 0;
}
2번 주사위
~cpp
#include<iostream>
#include<time.h>
using namespace std;
int die();
void main()
{
int di;
srand(time(NULL));
di = die();
cout << di;
cout << "\n";
}
int die()
{
int num,num_;
num = rand();
num_ = num % 6 + 1;
return num_;
}
3.난장이호출
~cpp
#include<iostream>
#include<time.h>
using namespace std;
void princess();
void first();
void second();
void third();
void forth();
void fifth();
void sixth();
void seventh();
void main()
{
princess();
}
void princess()
{
int num,num_;
srand(time(NULL));
num = rand();
num_ = num%7 +1;
if(num_ == 1){
first();
}
else if(num_ == 2 ){
second();
}
else if(num_ == 3 ){
third();
}
else if(num_ == 4 ){
forth();
}
else if(num_ == 5 ){
fifth();
}
else if(num_ == 6 ){
sixth();
}
else if(num_ == 7 ){
seventh();
}
}
void first()
{
cout<<"second";
cout<<"\n";
second();
}
void second()
{
cout<<"third";
cout<<"\n";
third();
}
void third()
{
cout<<"forth";
cout<<"\n";
forth();
}
void forth()
{
cout<<"fifth";
cout<<"\n";
fifth();
}
void fifth()
{
cout<<"sixth";
cout<<"\n";
sixth();
}
void sixth()
{
cout<<"seventh";
cout<<"\n";
seventh();
}
void seventh()
{
cout<<"princess";
cout<<"\n";
}