using System;
class intstring
{
}
class testman
{
public static void Main()
{
string i,strName=null, strKorean=null, strEnglish=null, strMath=null,number=null; // i = 출력할 학생수 //number = 번호선택
int strSum=0, numberInt=0 , cnt=0, cntPlus=-1 ,iInt; //
float strAvg;
Console.Write("출력할 학생수를 입력하세요 : ");
i=Console.ReadLine();
Console.WriteLine("");
Console.WriteLine(" {0} 명의 학생을 출력할수있습니다 ",i);
Console.WriteLine("");
iInt = int.Parse(i);
string[] Sarray = new string[iInt];
int r =1;
while (r == 1)
{
Console.WriteLine("===========================================");
Console.WriteLine("== 이름 국어 영어 수학 총점 평균 ==");
Console.WriteLine("== ==");
Console.WriteLine("== 1번 : 입력 2번: 출력 3번 : 나가기 ==");
Console.WriteLine("== ==");
Console.WriteLine("===========================================");
Console.WriteLine("");
Console.Write("**번호를 입력하세요** 1번, 2번, 3번: ");
Console.WriteLine("");
number = Console.ReadLine();
numberInt = int.Parse(number);
if (numberInt == 1)
{
if (cntPlus+1 == iInt)
{
Console.WriteLine("입력학생수 초과~!!");
break;
}
else
{
Console.Write("이름을 입력하세요 :");
strName = Console.ReadLine();
Console.Write("국어점수를 입력하세요 :");
strKorean = Console.ReadLine();
Console.Write("영어점수를 입력하세요 :");
strEnglish = Console.ReadLine();
Console.Write("수학점수를 입력하세요 :");
strMath = Console.ReadLine();
cntPlus++;
Console.WriteLine("## {0}명이 저장되었습니다##",cntPlus+1);
}
}
else
if (numberInt == 2)
{
strSum = int.Parse(strEnglish) + int.Parse(strKorean) + int.Parse(strMath);
strAvg = (float)strSum / 3;
Console.WriteLine();
Console.WriteLine("======================{0}명까지 출력할수있습니다======================", i);
if (cntPlus <= iInt & strSum != 0)
{
Sarray[cntPlus] = cntPlus + 1 + " 이름 :" + strName + " 국 어 : " + strKorean + " 영 어 : " + strEnglish + " 수 학 : " + strMath + " 총 점 : " + strSum + " 평 균 : " + (float)strAvg;
}
for (cnt = 0; iInt > cnt; cnt++) // cnt 로 배열 루프 iInt배열 값이될때까지
{
if (cntPlus >= cnt)
{
Console.WriteLine(Sarray[cnt]);
}
}
Console.WriteLine("===================================================================");
Console.WriteLine("");
Console.WriteLine("");
}else
if (numberInt == 3)
{
r = 0;
}
else
{
Console.WriteLine("잘못 입력하였습니다 ");
}
}
}
}
'Writer > WarmingUp Code' 카테고리의 다른 글
델리게이트 이벤트 소스 노가다 (0) | 2008.10.13 |
---|---|
눈물의 소스 박스형 for와 if 사용 첨부 상철 상봉 오윤 (0) | 2008.10.09 |
소스 복습 (0) | 2008.10.08 |
객체지향 소스 (0) | 2008.10.07 |
소스연습 (0) | 2008.10.06 |
프로퍼티 웜업소스 (0) | 2008.10.05 |
string ToString() bool float object enum boxing char (0) | 2008.10.04 |
복습 (0) | 2008.10.02 |