Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Homework_0927
- {
- class Program
- {
- // Market -> Seller 배열로 가지고있음. //?? 클래스 배열??
- // Buyer -> Market 구매.한구매자한테 한 번에 다 사도록
- // + 몇 %는 마켓이 세금으로 걷어감. Seller는 세금뺀나머지
- class seller
- {
- string m_sellerName;
- int m_sellerItem;
- int m_ItemCost;
- }
- class Market
- {
- Market(seller a_Seller)
- {
- seller mnSeller = a_Seller;
- }
- public void print()
- {
- Console.WriteLine(mnSeller);
- }
- int m_TaxSum;
- seller mnSeller;
- }
- class Buyer
- {
- string m_BuyerName;
- int m_BuyerItem;
- int m_ItemCost;
- //public BuyItem()
- //{
- //}
- }
- class StringReverse
- {
- public void SetStringRevers(string a_Inputstring)
- {
- m_Inputstring = a_Inputstring;
- for (int i = m_Inputstring.Length; i > 0; i--)
- {
- m_Outputstring += m_Inputstring[i - 1].ToString(); //인풋은 배열끝에서 시작 하나씩 내려가면서 입력
- //m_Outputstring 앞에서 부터 채워지기 시작하면서 리버스
- Console.WriteLine(m_Inputstring[i - 1].ToString());
- }
- Console.WriteLine(m_Outputstring);
- }
- string m_Inputstring;
- string m_Outputstring;
- }
- class Zondia
- {
- string[] m_eZondia = new string[] { "원숭이", "닭", "개", "돼지", "쥐", "소", "호랑이", "토끼", "용", "뱀", "말", "양" };
- string[] m_cheongan = new string[] { "경", "신", "임", "계", "갑", "을", "병", "정", "무", "기" };
- string[] m_gigi = new string[] { "신", "유", "술", "해", "자", "축", "인", "묘", "진", "사", "오", "미" };
- int m_nYear;
- public void SetZondia(int a_nYear)
- {
- m_nYear = a_nYear;
- int Cheon = m_nYear % 10;
- int gigi = m_nYear % 12;
- Console.WriteLine($"{m_nYear}의 띠는 {m_eZondia[gigi]}이고 {m_cheongan[Cheon]}{m_gigi[gigi]}년 입니다");
- }
- }
- class Fibo
- {
- int[] mFibo;
- public void SetFibo(int a_nFiboLenth, int a_nFiboNum)
- {
- int mFiboLenth = a_nFiboLenth;
- int mFiboNum = a_nFiboNum;
- mFibo = new int[mFiboLenth];
- mFibo[0] = 1;
- mFibo[1] = 1;
- for (int i = 2; i < mFibo.Length; i++)
- {
- mFibo[i] = mFibo[i - 1] + mFibo[i - 2];
- }
- foreach (var a in mFibo)
- {
- Console.WriteLine(a);
- }
- Console.WriteLine($"{mFiboNum}번째 숫자는: {mFibo[mFiboNum - 1]}");
- }
- }
- class gugu
- {
- public void Rungugu()
- {
- for (int i = 2; i <= 9; i++)
- {
- for (int j = 1; j < 9; j++)
- {
- Console.WriteLine($"{i}*{j} = {i*j}");
- }
- }
- }
- }
- class Factorial
- {
- public void SetFacto(int a_nNum)
- {
- if (a_nNum <= 0)
- {
- Console.WriteLine("0보다 큰수를 입력하세요");
- return;
- }
- int m_nNum = a_nNum;
- int temp = 1;
- for (int i = 1; i < m_nNum; i++)
- {
- temp *= i;
- Console.WriteLine($"{i}!{temp}");
- }
- }
- }
- class RPS
- {
- int mUser;
- int mCom;
- Random r = new Random();
- public void RPSrun(int a_User)
- {
- if (a_User > 4)
- {
- Console.WriteLine("가위바위보 중에 하나를 내세요 다른거 내지말고");
- return;
- }
- if (a_User <= 0)
- {
- Console.WriteLine("0이거나 적은값이 출력되었습니다.");
- return;
- }
- mUser = a_User;
- mCom = r.Next(1, 3);
- //가위1, 바위2, 보3 // 상성 2 가 1 이김, 3이 2이김 , 3이 1에게 짐
- if (mUser==1 && mCom==2)
- {
- Console.WriteLine("유저 : 가위 , 컴퓨터 : 바위 /// 컴퓨터 승");
- }
- else if (mUser == 1 && mCom == 3)
- {
- Console.WriteLine("유저 : 가위 , 컴퓨터 : 보 /// 유저 승");
- }
- else if (mUser == 2 && mCom == 1)
- {
- Console.WriteLine("유저 : 바위 , 컴퓨터 : 가위 /// 유저 승");
- }
- else if (mUser == 2 && mCom == 3)
- {
- Console.WriteLine("유저 : 바위 , 컴퓨터 : 보 /// 컴퓨터 승");
- }
- else if (mUser == 3 && mCom == 1)
- {
- Console.WriteLine("유저 : 보 , 컴퓨터 : 가위 /// 컴퓨터 승");
- }
- else if (mUser == 3 && mCom == 2)
- {
- Console.WriteLine("유저 : 보 , 컴퓨터 : 바위 /// 유저 승");
- }
- else
- {
- Console.WriteLine("비김 다시하세요.");
- }
- }
- }
- static void Main(string[] args)
- {
- Fibo fibo = new Fibo();
- fibo.SetFibo(10, 5);
- Factorial fac = new Factorial();
- fac.SetFacto(10);
- RPS rps = new RPS();
- rps.RPSrun(3);
- rps.RPSrun(2);
- rps.RPSrun(1);
- rps.RPSrun(1);
- rps.RPSrun(1);
- rps.RPSrun(1);
- Console.WriteLine();
- Zondia nZondia = new Zondia();
- nZondia.SetZondia(1986);
- nZondia.SetZondia(1988);
- nZondia.SetZondia(1987);
- StringReverse sr = new StringReverse();
- sr.SetStringRevers("abcdef");
- gugu newgugu = new gugu();
- newgugu.Rungugu();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement