== 이차형 ==
함수만들기
~cpp
#include <iostream>
using namespace std; 

bool team684(int, int, int);

void main()
{
	int member=0;
	int guns=0;
	int boat=0;
	
	team684(member, guns, boat);
}

bool team684(int member, int guns, int boat)
{

	cout << "대원의 수를 입력하시오 : ";
	cin >> member;
	cout << "\n"

	cout << "총의 수를 입력하시오 : ";
	cin >> guns;
	cout << "\n"

	cout << "보트의 수를 입력하시오 : ";
	cin >> boat;
	cout << "\n"

	if (member>guns)
	{
		cout << "총의 수가 부족합니다.\n\n";
	}
	else
	{
		cout << "총의 수는 충분합니다.\n\n";
	}

	if (boat*8<member)
	{
		cout << "보트의 수가 부족합니다.\n\n";
	}
	else
	{
		cout << "보트의 수는 충분합니다.\n\n";
	}
	
	if (member<=guns && boat*8>member)
	{
		cout << "암살에 성공하셨습니다.\n\n";
	}
	else
	{
		cout << "암살에 실패하셨습니다.\n\n";
	}

	return 0;
}

주사위 숫자 출력
~cpp
#include <iostream>
#include <time.h>

using namespace std; 

int dice(int num, int dice);

int main()
{
	int num, dic;

	dice(num, dic);
	return 0;	
}

int dice(int num, int dic)
{
	srand(time(NULL));

	num = rand();
	
	dic = num%6+1;

	cout << dic <<"\n";

	return 0;
}

백설공주와 일곱난장이의 상관관계
~cpp
#include <iostream>
#include <time.h>
using namespace std; 

int first();
int second();
int third();
int fourth();
int fifth();
int sixth();
int seventh();
int snow_white();

void main()
{
	int brother=0;
	int number=0;

	srand(time(NULL));

	number = rand();
	brother = number%7+1;

	if(brother==1)
	{
		first();
	}
	else if(brother==2)
	{
		second();
	}
	else if(brother==3)
	{
		third();
	}
	else if(brother==4)
	{
		fourth();
	}
	else if(brother==5)
	{
		fifth();
	}
	else if(brother==6)
	{
		sixth();
	}
	else if(brother==7)
	{
		seventh();
	}

}

int first()
{
	cout << "first dwarfs\n";

	second();

	return 0;
}

int second()
{
	cout << "second dwarfs\n";

	third();

	return 0;
}

int third()
{
	cout << "third dwarfs\n";

	fourth();

	return 0;
}

int fourth()
{
	cout << "fourth dwarfs\n";

	fifth();

	
	return 0;
}

int fifth()
{
	cout << "fifth dwarfs\n";

	sixth();


	return 0;
}

int sixth()
{
	cout << "sixth dwarfs\n";

	seventh();

	return 0;
}

int seventh()
{
	cout << "seventh dwarfs\n";

	snow_white();

	return 0;
}

int	snow_white()
{
	cout << "snow white\n";

	return 0;
}
Retrieved from http://wiki.zeropage.org/wiki.php/데블스캠프2006/월요일/함수/문제풀이/이차형
last modified 2021-02-07 05:29:05