전체 를 움직이 는 프로젝터 프로그램 - - - - - - - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; namespace Example { class Program { static void Main ( string [ ] args ) { new DoWhileEx ( ) ; } } } - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; using System . Collections ; namespace Example { class FOREACHEX { public FOREACHEX ( ) { int [ ] count = new int [ 10 ] { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 }; ArrayList arr = new ArrayList ( ) ; arr . Add ( 1 ) ; arr . Add ( " 정광희 "); arr . Add ( " 1972 . 03 . 03 "); arr . Add ( DateTime . Now ) ; foreach ( int tmp in count ) { Console . WriteLine ( tmp ) ; } foreach ( object tmp in arr ) { Console . WriteLine ( tmp ) ; } } } } - - - - - - - - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; namespace Example { class DoWhileEx { public DoWhileEx ( ) { int sum = 0 ; int i = 1 ; do { sum += i ; i ++; } while ( i <= 100 ) ; Console . WriteLine ( " 1 에서 100 의 합 은 " + sum ) ; } } } - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; using System . Collections ; namespace Example { class FOREACHEX { public FOREACHEX ( ) { int [ ] count = new int [ 10 ] { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 }; ArrayList arr = new ArrayList ( ) ; arr . Add ( 1 ) ; arr . Add ( " 정광희 "); arr . Add ( " 1972 . 03 . 03 "); arr . Add ( DateTime . Now ) ; foreach ( int tmp in count ) { Console . WriteLine ( tmp ) ; } foreach ( object tmp in arr ) { Console . WriteLine ( tmp ) ; } } } } - - - - - - - - - - - - - - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; namespace Example { class FOREX { public FOREX ( ) { Console . WriteLine ( " 구구단 "); char dan = ( char ) Console . Read ( ) ; for ( int i = 1 ; i < 10 ; i ++) { Console . WriteLine ( "{ 0 }*{ 1 }={ 2 }", Convert . ToInt 32 ( dan . ToString ( ) ) , i , Convert . ToInt 32 ( dan . ToString ( ) ) * i ) ; } } } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; namespace Example { class gugudanEX { public gugudanEX ( ) { for ( int i = 1 ; i < 10 ; i ++) { for ( int j = 1 ; j < 10 ; j ++) { Console . WriteLine ( "{ 0 }*{ 1 }={ 2 }", i , j , i * j ) ; } Console . WriteLine ( ""); } } } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; namespace Example { class gugudanEX { public gugudanEX ( ) { for ( int i = 1 ; i < 10 ; i ++) { for ( int j = 1 ; j < 10 ; j ++) { Console . WriteLine ( "{ 0 }*{ 1 }={ 2 }", i , j , i * j ) ; } Console . WriteLine ( ""); } } } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; namespace Example { class IFEX { public IFEX ( ) { int a = 100 ; string str = " A "; if ( ! str . Equals ( " B ")) { if ( a == 100 ) { Console . WriteLine ( " str 는 { 0 } 입니다 . ", a ) ; } Console . WriteLine ( " str 는 { 0 } 입니다 . ", str ) ; } else { Console . WriteLine ( " str 는 { 0 } 이 였 군요 . ", str ) ; } } } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; namespace Example { class SwitchCaseEx { public SwitchCaseEx ( ) { / / int a = 100 ; string str = " 화 "; switch ( str ) { case " 월 ": Console . WriteLine ( " 월 입니다 . "); break ; case " 화 ": Console . WriteLine ( " 화 입니다 . "); break ; default : Console . WriteLine ( " 기본 값 입니다 . "); break ; } } } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ------------------------- using System ; using System . Collections . Generic ; using System . Text ; namespace Example { class TypeEx { byte b ; int i ; long j = 12 L ; string str ; float f = 1 . 1 f ; double d = 1 . 22 ; decimal dec = 1 . 222222 m ; public TypeEx ( ) { Console . WriteLine ( "{ 0 }\ r \ n { 1 }\ r \ n { 2 }", b . GetType ( ) . Name , sizeof ( byte ) , b ) ; Console . WriteLine ( "{ 0 }\ r \ n { 1 }\ r \ n { 2 }", i . GetType ( ) . Name , sizeof ( int ) , i ) ; Console . WriteLine ( "{ 0 }\ r \ n { 1 }\ r \ n { 2 }", j . GetType ( ) . Name , sizeof ( long ) , j ) ; Console . WriteLine ( "{ 0 }\ r \ n { 1 }\ r \ n { 2 }", f . GetType ( ) . Name , sizeof ( float ) , f ) ; Console . WriteLine ( "{ 0 }\ r \ n { 1 }\ r \ n { 2 }", d . GetType ( ) . Name , sizeof ( double ) , d ) ; Console . WriteLine ( "{ 0 }\ r \ n { 1 }\ r \ n { 2 }", dec . GetType ( ) . Name , sizeof ( decimal ) , dec ) ; } } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -------------------------