Proteced Test
-protected 접근 지정자를 사용한 멤버 필드와 메소드는 파생 클래스에서는 사용가능하나 클래스 외부에서는 호출하지 못함1264274415.cs
Monthly Archives: September 2009
lecture5
lecture5-OOP1200024170.pdf
Assignment2
연습문제 Ex2 (Due by 9/24 목 24시까지)1307735758.hwp
-cyber 강의실 (cyber.dku.edu)로 source code, executable file, solution/project VC# file, 보고서를 학번_이름_Ex2.zip으로 묶어서 낼 것. 보고서 (30%)
[연습문제]
1. Ex1 (학생 학점을 출력하는 프로그램인 StudentGrade 클래스 숙제)에 Student 구조체를 사용하여 다시 작성하라 (그리고, Student.cs 파일로 저장한다). Student 구조체에는 학생 이름(name), 국어(kor), 영어(eng), 수학(math), 학점(grade)이 데이터 멤버로 포함되어야 한다. (30%)
– Student(string n, int k, int e, int m) 생성자
– int GetTotal() 함수는 국어, 영어, 수학의 총점 값을 반환 (Ex1과 동일)
– int GetAverage() 함수는 국어, 영어, 수학의 평균 값을 반환 (Ex1과 동일)
– Grade GetGrade() 함수는 학생 성적평균이 90이상이면 A, 80-90이면 B, 70-80이면 C, 60-70이면 D, 60이하 F인 enum type인 Grade 값을 반환 (Ex1과 동일)
– PrintGrade() 함수는 학생의 이름과 국어, 영어, 수학 성적 및 총점, 평균, 학점을 화면에 출력
2. Main 함수에서는 10개의 Student 구조체를 Array로 생성하고 키보드 입력으로 학생 이름, 국어, 영어, 수학 점수를 받아서, 각 학생별로 총점, 평균, 학점을 출력하고, 전체 학생에 대한 평균 총점, 평균을 출력하는 routine을 추가한다. (20%)
– for 문을 사용하여 10명 학생의 이름, 국어, 영어, 수학 점수를 입력받음
– foreach 문을 사용하여 10명 학생에 대한 개별적인 성적 출력과 전체 학생의 평균 총점및 평균을 계산 후 출력
3. Main 함수에서 본인이 더 테스트해보고 싶은 Method나 routine을 추가하라. (20%)
Statement & Method
Break Statement vs. Continue Statement
1075903897.cs
Recursive Method
1306158747.cs
디버그모드에서 윈도우창을 계속 열기위한 방법
Visual Studio 2008에서 F5(Debug) 실행시 윈도우 창을 계속 열기 위한 방법
// Keep the console window open in debug mode.
Console.WriteLine(“Press any key to exit.”);
Console.ReadKey();
Array & Struct
Array1220407129.cs
Struct1267020452.cs
Operator
Arithmetic Operator1288618202.cs
Temperature Converter1336130967.cs
DataType
Boolean (bool)
1100942857.cs
Character (char)
1155938361.cs
Enumeration (enum)
1028714810.cs
Numeric (int, long, float, double, decimal, etc)
1104654313.cs
String1157964094.cs
Object1196044571.cs
Build.bat 1165214317.xxx
HelloWorld
HelloWorld 예제
// Hello1.cs
public class Hello1
{
public static void Main()
{
System.Console.WriteLine(“Hello, World!”);
}
}
// Hello2.cs – using System을 사용
using System;
public class Hello2
{
public static void Main()
{
Console.WriteLine(“Hello, World!”);
}
}
// Hello3.cs – program argument 를 처리
// arguments: A B C D
using System;
public class Hello3
{
public static void Main(string[] args)
{
Console.WriteLine(“Hello, World!”);
Console.WriteLine(“You entered the following {0} command line arguments:”,
args.Length );
for (int i=0; i < args.Length; i++)
{
Console.WriteLine(“{0}”, args[i]);
}
}
}
// Hello4.cs – Main 메소드에 반환인자를 넣을 경우
using System;
public class Hello4
{
public static int Main(string[] args)
{
Console.WriteLine(“Hello, World!”);
return 0;
}
}
lecture4 – C# Basics
lecture4 – C# Basics
Methods, Variables, Array1141554847.pdf