Skip to content

Commit

Permalink
feat: 프로그램 실행 함수 추가, 게임 시작 함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Diana-yjh committed Jan 3, 2024
1 parent 21af416 commit a13ce26
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion NumberBaseball/NumberBaseball/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,32 @@

import Foundation

print("Hello, World!")
func execute(){
print("1. 게임시작")
print("2. 게임종료")
print("원하는 기능을 선택해주세요: ", terminator: "")

var input = readLine()

if input == "1"{
//gameStart()
} else if input == "2" {

} else {
execute()
}
}

func gameStart(){
var comNum1 = Int.random(in: 1...9)
var comNum2 = Int.random(in: 1...9)
var comNum3 = Int.random(in: 1...9)

var userInput = readLine()?.split(separator: "")

if userInput.count < 3 {
print("입력이 잘못 되었습니다.")
print("숫자 3개를 띄어쓰기로 구분하여 입력해주세요.")
print("중복된 숫자는 허용되지 않습니다!")
}
}

0 comments on commit a13ce26

Please sign in to comment.