Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

새싹교실/2016/탈레반/0328: Difference between revisions

From ZeroWiki
imported>wb092311
No edit summary
imported>kiissy
No edit summary
Line 38: Line 38:
== 김소연 ==
== 김소연 ==
# 가위바위보
# 가위바위보
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
   
   
 
int main()
{
int you, s, com;
int win, lose, same;
win = 0;
lose = 0;
same = 0;
printf("가위 바위 보를 선택하세요. (가위:1, 바위:2, 보:3) : ");
scanf("%d", &you);
while (you = 1 || 2 || 3) {
if (you = 1) {
printf("가위를 내셨습니다.\n");
s = rand();
com = s % 4;
while (com = 0) {
s = rand();
com = s % 4;
}
if (com = 1) {
printf("컴퓨터는 가위를 냈습니다.\n");
printf("비겼습니다.\n");
same++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
else if (com = 2) {
printf("컴퓨터는 바위를 냈습니다.\n");
printf("컴퓨터가 이겼습니다.\n");
lose++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
else if (com = 3) {
printf("컴퓨터는 보를 냈습니다.\n");
printf("당신이 이겼습니다.\n");
win++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
}
else if (you = 2) {
printf("바위를 내셨습니다.\n");
s = rand();
com = s % 4;
while (com = 0) {
s = rand();
com = s % 4;
}
if (com = 1) {
printf("컴퓨터는 가위를 냈습니다.\n");
printf("당신이 이겼습니다.\n");
win++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
else if (com = 2) {
printf("컴퓨터는 바위를 냈습니다.\n");
printf("비겼습니다.\n");
same++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
else if (com = 3) {
printf("컴퓨터는 보를 냈습니다.\n");
printf("컴퓨터가 이겼습니다.\n");
lose++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
}
else if (you = 3) {
printf("보를 내셨습니다.\n");
s = rand();
com = s % 4;
while (com = 0) {
s = rand();
com = s % 4;
}
if (com = 1) {
printf("컴퓨터는 가위를 냈습니다.\n");
printf("비겼습니다.\n");
same++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
else if (com = 2) {
printf("컴퓨터는 바위를 냈습니다.\n");
printf("컴퓨터가 이겼습니다.\n");
lose++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
else if (com = 3) {
printf("컴퓨터는 보를 냈습니다.\n");
printf("당신이 이겼습니다.\n");
win++;
printf("%d승 %d패 %d무\n", win, lose, same);
printf("\n20165417 김소연\n\n");
}
}
printf("가위 바위 보를 선택하세요. (가위:1, 바위:2, 보:3) : ");
scanf("%d", &you);
}
return 0;
}
# 생각한 수
# 생각한 수
   
   

Revision as of 14:17, 29 March 2016

참여자

강사 반페이지 학생
장우진 탈레반 김소연 박서현 허수민
O O O

진행

  • 장소 : 6층 피씨실
  • 시간 : 5 : 00 ~ 7 : 00

진행상황

  • scanf 보충설명 - 버퍼, getchar(), scanf_s()에 대해서
  • 연산자
  • 조건문
  • 반복문


과제

  • 1. 가위바위보 게임을 만들자 - (필수)
  • 2. 컴퓨터가 생각한 수를 맞춰보자 - (해오면 음료)

김소연

  1. 가위바위보
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int you, s, com;
	int win, lose, same;
	win = 0;
	lose = 0;
	same = 0;

	printf("가위 바위 보를 선택하세요. (가위:1, 바위:2, 보:3) : ");
	scanf("%d", &you);
	
	while (you = 1 || 2 || 3) {
		if (you = 1) {
			printf("가위를 내셨습니다.\n");

			s = rand();
			com = s % 4;

			while (com = 0) {
				s = rand();
				com = s % 4;
			}

			if (com = 1) {
				printf("컴퓨터는 가위를 냈습니다.\n");
				printf("비겼습니다.\n");
				same++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}

			else if (com = 2) {
				printf("컴퓨터는 바위를 냈습니다.\n");
				printf("컴퓨터가 이겼습니다.\n");
				lose++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}

			else if (com = 3) {
				printf("컴퓨터는 보를 냈습니다.\n");
				printf("당신이 이겼습니다.\n");
				win++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}
		}

		else if (you = 2) {
			printf("바위를 내셨습니다.\n");

			s = rand();
			com = s % 4;

			while (com = 0) {
				s = rand();
				com = s % 4;
			}

			if (com = 1) {
				printf("컴퓨터는 가위를 냈습니다.\n");
				printf("당신이 이겼습니다.\n");
				win++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}

			else if (com = 2) {
				printf("컴퓨터는 바위를 냈습니다.\n");
				printf("비겼습니다.\n");
				same++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}

			else if (com = 3) {
				printf("컴퓨터는 보를 냈습니다.\n");
				printf("컴퓨터가 이겼습니다.\n");
				lose++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}
		}

		else if (you = 3) {
			printf("보를 내셨습니다.\n");

			s = rand();
			com = s % 4;

			while (com = 0) {
				s = rand();
				com = s % 4;
			}

			if (com = 1) {
				printf("컴퓨터는 가위를 냈습니다.\n");
				printf("비겼습니다.\n");
				same++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}

			else if (com = 2) {
				printf("컴퓨터는 바위를 냈습니다.\n");
				printf("컴퓨터가 이겼습니다.\n");
				lose++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}

			else if (com = 3) {
				printf("컴퓨터는 보를 냈습니다.\n");
				printf("당신이 이겼습니다.\n");
				win++;
				printf("%d승 %d패 %d무\n", win, lose, same);
				printf("\n20165417 김소연\n\n");
			}
		}

		printf("가위 바위 보를 선택하세요. (가위:1, 바위:2, 보:3) : ");
		scanf("%d", &you);
	}

	return 0;
}
  1. 생각한 수

박서현

  1. 가위바위보


  1. 생각한 수

허수민

  1. 가위바위보


  1. 생각한 수


후기

  • 사진은 잘 쓰도록 하겠습니다. - 박인서

새싹교실/2016 새싹교실/2016/탈레반