임다찬

함수만들기
~cpp
#include <iostream>
using namespace std; 
bool team684(int people,int gun,int boat){
	if((people+gun)*boat>=200)
		return true;
	else
		return false;
}
void main() { 
	if(team684(10,30,10))
		cout << "Complete";
	else
		cout << "fault";
	cout << endl;
}
----
주사위
~cpp
#include <iostream>
#include <time.h>
using namespace std; 
int ju42(){
	srand(time(NULL));
	return (rand()%6+1);
}
int main(){
	cout << ju42() << endl;
	return 0;
}
----
백설공주
~cpp
#include <iostream>
#include <time.h>
using namespace std; 
void nan1();
void nan2();
void nan3();
void nan4();
void nan5();
void nan6();
void nan7();
void pr100();
int main(){
	int c;
	srand(time(NULL));
	c=rand()%7+1;
	switch(c){
		case 1: nan1(); break;
		case 2: nan2(); break;
		case 3: nan3(); break;
		case 4: nan4(); break;
		case 5: nan5(); break;
		case 6: nan6(); break;
		case 7: nan7(); break;
		default: pr100; break;
	}
	nan4();
	return 0;
}
void nan1(){
	cout << "첫째 난장이가 둘째를 부른다" << endl;
	nan2();
}
void nan2(){
	cout << "둘째 난장이가 셋째를 부른다" << endl;
	nan3();
}
void nan3(){
	cout << "셋째 난장이가 넷째를 부른다" << endl;
	nan4();
}
void nan4(){
	cout << "넷째 난장이가 다섯째를 부른다" << endl;
	nan5();
}
void nan5(){
	cout << "다섯째 난장이가 여섯째를 부른다" << endl;
	nan6();
}
void nan6(){
	cout << "여섯째 난장이가 일곱째를 부른다" << endl;
	nan7();
}
void nan7(){
	cout << "일곱째 난장이가 백설공주를 부른다" << endl;
	pr100();	
}
void pr100(){
	cout << "백설공주" << endl;	
}
Retrieved from http://wiki.zeropage.org/wiki.php/데블스캠프2006/월요일/함수/문제풀이/임다찬
last modified 2021-02-07 05:29:05