ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 소스연습
    Writer/WarmingUp Code 2008. 10. 6. 21:19
    반응형
    using System;

    class student
    {
    public static void Main()
    {

    string strName = null, strKorean = null, strEnglish = null, strMath = null;
    int strSum = 0 , cnt=1;
    float strAvg = 0;



    while(cnt == 1)
    {
    Console.WriteLine("====================================");
    Console.WriteLine("====================================");
    Console.WriteLine("===이름  국어 영어 수학 총점 평균===");
    Console.WriteLine("====================================");
    Console.WriteLine("====================================");
    Console.WriteLine("==1번 입력 ==2번 출력 ==3번 종료====");
    Console.WriteLine("====================================");
    Console.WriteLine("====================================");
    Console.Write("번호를 입력하세요 : ");
    string num = Console.ReadLine();

    if( num == "1")
    {
    Console.Write("이름을 입력하세요 :");
    strName = Console.ReadLine();
    Console.Write("국어 점수를 입력하세요 :");
    strKorean = Console.ReadLine();
    Console.Write("영어 점수를 입력하세요 :");
    strEnglish = Console.ReadLine();
    Console.Write("수학을 입력하세요 :");
    strMath = Console.ReadLine();
    strSum = (int.Parse(strKorean) + int.Parse(strEnglish) +int.Parse(strMath)); //총점
    strAvg = (float)strSum / 3; //평균
    }
    if( num =="2")
    {
    Console.WriteLine("============================================");
    Console.WriteLine("== 이름  국어  영어  수학   총점   평균 ====");
    Console.WriteLine("== {0}  {1}   {2}    {3}     {4}   {5:f1}  ===",strName,strKorean,strEnglish,strMath, strSum , strAvg);
    Console.WriteLine("============================================");
    }
    if(num =="3")
    {
    cnt=0;
    Console.WriteLine("안녕 잘자~!!");
    }
    }
    }
    }
    반응형

    'Writer > WarmingUp Code' 카테고리의 다른 글

    눈물의 소스 박스형 for와 if 사용 첨부 상철 상봉 오윤  (0) 2008.10.09
    소스 복습  (0) 2008.10.08
    객체지향 소스  (0) 2008.10.07
    성적출력  (0) 2008.10.07
    프로퍼티 웜업소스  (0) 2008.10.05
    string ToString() bool float object enum boxing char  (0) 2008.10.04
    복습  (0) 2008.10.02
    클래스 구조체  (0) 2008.10.01

    댓글

Designed by Tistory.