using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Helloworld
{
class Program
{
static void Main(string[] args)
{
//어떤 음식을 드시겠습니까? : 초밥
//몇번 드시겠습니까? : 3
//초밥을 먹었습니다.
//초밥을 먹었습니다.
//초밥을 먹었습니다.
Console.Write("어떤 음식을 드시겠습니까? :");
string name = Console.ReadLine();
Console.Write("몇번 드시겠습니까? :");
int num = Convert.ToInt32(Console.ReadLine());
EatingFood("초밥", 3);
}
static void EatingFood(string name, int num)
{
for(int i = 0; i<num; i++)
{
Console.WriteLine("{0}을 먹었습니다.", name, num);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Helloworld
{
class Program
{
static void Main(string[] args)
{
//미네랄을 캐는 캐릭터는 뭔가요? : SCV
//몇개를 캤습니까? : 8
//미네랄을 캤습니다.
//미네랄을 캤습니다.
//미네랄을 캤습니다.
//미네랄을 캤습니다.
//미네랄을 캤습니다.
//미네랄을 캤습니다.
//미네랄을 캤습니다.
//미네랄을 캤습니다.
Console.Write("미네랄을 캐는 캐릭터는 뭔가요? :");
string name = Console.ReadLine();
Console.Write("몇개를 캤습니까? :");
int mineral = Convert.ToInt32(Console.ReadLine());
HarvestingCharacter("SCV", 8);
}
static void HarvestingCharacter(string name, int mineral)
{
for(int i = 0; i<mineral; i++)
{
Console.WriteLine("{0}을 캤습니다.", name, mineral);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Helloworld
{
class Program
{
static void Main(string[] args)
{
//생성할 캐릭터는 무엇인가요? : 돼지
//몇개를 생성할까요? : 5
//돼지를 생성했습니다.
//돼지를 생성했습니다.
//돼지를 생성했습니다.
//돼지를 생성했습니다.
//돼지를 생성했습니다.
Console.Write("생성할 캐릭터는 무엇인가요? :");
string name = Console.ReadLine();
Console.Write("몇개를 생성할까요? :");
int mineral = Convert.ToInt32(Console.ReadLine());
ProduceCharacter("돼자", 5);
}
static void ProduceCharacter(string name, intehowl Pig)
{
for(int i = 0; i< Pig; i++)
{
Console.WriteLine("{0}를 생성했습니다.", name, Pig);
}
}
}
}
'c# > 복습 공부' 카테고리의 다른 글
클래스와 메서드 연습 10문제 (0) | 2021.08.27 |
---|---|
20210826 - 과제 10개 (0) | 2021.08.26 |
생성자 메서드 10개 연습하기 (0) | 2021.08.25 |
메서드 반환값x 매개변수o 문제 (0) | 2021.08.24 |
메서드 기본문제 만들어 풀기 (0) | 2021.08.23 |