반응형
///////////////////////////////////////////////////////////////////////////////////////////////////
전광식
///////////////////////////////////////////////////////////////////////////////////////////////////
using System;
namespace jks
{
class program
{
public void jks()
{
string ch=null;
Console.WriteLine("a : 박스형 for");
Console.WriteLine("b : 박스형 if ");
ch=Console.ReadLine();
if (ch == "a")
{
int n = 65;
int nsum=0;
int i = 0;
int i2=0;
for(int j = 0 ;j < 26 ; j++)
{
for(i = 0 ; i <26 & nsum < 90 ; i++)
{
nsum=n+i;
Console.Write((char)(n+i));
}
for(i2=0 ;i<26 ;i++,i2++)
{
Console.Write((char)(65 + i2));
}
n=n+1;
nsum=0;
Console.WriteLine();
}
}
if(ch== "b")
{
int chInt=65;
int chIntSum=0;
char chChar='A';
chChar=Convert.ToChar(ch);
int k=0;
for(int j =0 ; j< 26 ; j++)
{
for (int i = 0 ; i <26 ; i++)
{
chIntSum= chInt+i;
if(chIntSum > 90 )
{
Console.Write((Convert.ToChar(65 + k) + " "));
k++;
}else Console.Write((Convert.ToChar(chInt+i)+" "));
}
k=0;
Console.WriteLine();
chInt=chInt+1;
}
}
}
}
class jks
{
public static void Main()
{
program ks = new program();
ks.jks();
}
}
}
/////////////////////////////////////////////////////////////////////////////////////
차상봉
///////////////////////////////////////////////////////////////////////////////////
public static void box()
{
for (int i = 0; i <= 25; i++)
{
for (int j = 0; j <= 25; j++)
{
if ((i + j) > 26)
Console.Write(" " + ((char)('A'+i + j - 26)));
else
Console.Write(" " + ((char)('A' + i + j)));
}
Console.WriteLine();
}
}
// 피라미드로 출력한다. 선택문자는 b
public static void pira()
{
for (int i = 0; i <= 25; i++)
{
for (int k = i; k <= 25; k++)
Console.Write(" ");
for (int j = 25-i; j <= 25; j++)
{
Console.Write(" " + ((char)(40 + i + j)));
}
Console.WriteLine();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
강상철
//////////////////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
namespace _008Test
{
class Test
{
char temp;
public void Menu()
{
Console.WriteLine("###### 메 뉴 ######");
Console.WriteLine("A. box 출룍");
Console.WriteLine("B. 피라미드출력");
Console.WriteLine("C. 종료");
Console.WriteLine("###################");
}
public void outputa()
{
for (int i = 0; i < 26 ; i++)
{
for (int j = 0; j < 26; j++)
{
temp = (char)(65+i+j);
if (temp > 90)
{
temp -= (char)26;
}
Console.Write(temp+" ");
}
Console.WriteLine();
}
}
public void output2()
{
char temp2;
int ma = 30;
int s = 0;
for (int i = 0 ; i < 30;i++)
{
Console.Write("{0," + ma + "}"," ");
for (int j = 1; j < 30; j++)
{
temp2 = (char)(65 + i + j);
if(i>j)
{
temp2 =(char)(65+s);
s++;
Console.Write(temp2+" ");
}
if (s == 26) s = 0;
}
Console.WriteLine();
ma--;
}
}
public void input()
{
for (; ; )
{
Menu();
string ip = Console.ReadLine();
ip = ip.ToUpper();
if (ip == "A")
{
outputa();
Console.WriteLine("\n");
}
else if (ip == "B")
{
output2();
}
else if (ip == "C")
{
Console.WriteLine("프로그램을 종료합니다.");
break;
}
else
{
Console.WriteLine("제대로 입력해");
}
}
}
}
class Program
{
static void Main(string[] args)
{
Test tt = new Test();
tt.input();
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
권오윤
///////////////////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
namespace Alpa
{
class Alphabet
{
private string sel;
public void Ainput()
{
Console.WriteLine();
Console.WriteLine("A.box로 출력");
Console.WriteLine("B.피라미드로 출력");
Console.WriteLine("C.다이아몬드로 출력");
Console.WriteLine("D.종료");
Console.Write("메뉴를 입력해 주세요 : ");
sel = Console.ReadLine();
}
public bool Aprint()
{
int tmp;
if (sel == "A" || sel == "a")
{
for (int i = 0; i < 26; i++)
{
for (int j = 0; j < 26; j++)
{
tmp = (65 + (i + j) % 26);
Console.Write(" {0}", (char)(tmp));
}
Console.WriteLine();
}
}
else if (sel == "B" || sel == "b")
{
int seq = 0;
for (int i = 26; i > 0; i--)
{
Console.Write("{0," + i + "}", "");
for (int j = i; j < 26; j++)
{
tmp = 65 + (seq % 26);
Console.Write(" {0}", (char)tmp);
seq++;
}
Console.WriteLine();
}
}
else if (sel == "C" || sel == "c")
{
int seq = 0;
for (int i = 13; i > -13; i--)
{
Console.Write("{0," + i + "}", "");
for (int j=i,m=i; (j<13)&&(m>-13); j++,m--)
{
tmp = 65 + (seq % 26);
Console.Write(" {0}", (char)tmp);
seq++;
}
Console.WriteLine();
}
}
else if (sel == "D" || sel == "d")
{
return false;
}
return true;
}
}
class Program
{
static void Main(string[] args)
{
Alphabet al = new Alphabet();
while (true)
{
al.Ainput();
if (al.Aprint() == false) break;
}
}
}
}
'Writer > WarmingUp Code' 카테고리의 다른 글
C# 과제 (0) | 2008.10.17 |
---|---|
abstract interface (0) | 2008.10.15 |
델리게이트 이벤트 소스 노가다 2 (0) | 2008.10.14 |
델리게이트 이벤트 소스 노가다 (0) | 2008.10.13 |
소스 복습 (0) | 2008.10.08 |
객체지향 소스 (0) | 2008.10.07 |
성적출력 (0) | 2008.10.07 |
소스연습 (0) | 2008.10.06 |