using System;
class stringTest
{
public static void Main()
{
sting a = "제이름은";
string b = "전광식입니다";
string c = "강민주입니다";
string e = a+b;
string f = a+c;
int g = 2001;
string h = "올해는" + g.ToString +"년입니다";
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
}
}
using System;
class objectTest
{
public static void Main()
{
object a = 22;
object b = 3.14;
objenct c = "abc";
Console.WriteLine("Value of a : {0}",a);
Console.WriteLine("Value of a : {0}",a.ToString());
Console.WriteLine("Value of a : {0}",aGetType);
Console.WriteLine();
Console.WriteLine("Value of b : {0}",b);
Console.WriteLine("Value of b : {0}",b.ToString());
Console.WriteLine("Value of b : {0}",b.GetType);
Console.WriteLine();
Console.WriteLine("Value of c : ",c);
Console.WriteLine("Value of c : ",c.ToString());
Console.WriteLine("Type of c : ",c.GetType);
}
}
using System;
class uerVar
{
public static void Main()
{
int a;
a = 3;
int b = 7;
Console.WriteLine("a는 : {0}",a);
Console.WriteLine("b는 : {0}",b);
}
}
using System;
class floatTest
{
public static void Main()
{
folat a = 3.14f;
double b = 3.14d;
double c = a*b;
Console.WriteLine("flat a : {0} double b: {1}",a, b);
Console.WriteLine("a * b : {0}", c);
}
}
using System;
class enumTest
{
enum Color
{
Red = 4;
Yellow = 25;
Blue,
White = Red * Yellow * Blue
}
Public static void Main()
{
Console.WriteLine("First member of Color is {0}",Color.Red);
Console.WriteLine("Value of Second member Yellow is {0}",(int)Color.Yellow);
Console.WriteLine("Third member of Color is {0}",Colr.Blue);
Console.WriteLine("Value of Blue is {0}",(int)Color.Blue);
Console.WriteLine("Value of White is {0}",(int)Color.White);
}
}
using System;
class DecimalTest
{
public static void Main()
{
float a = 22f;
float b = 7f;
float c = a/b;
Console.WriteLine("float type pie{0}",c);
double i = 22;
double j = 7;
double k = i/j;
Console.WriteLine("{0}",k);
decimal x = 22m;
decimal y = 7m;
decimal z = x/y;
Console.WriteLine("{0}",x);
}
}
using System;
class ConversionTest
{
public static void Mian()
{
string a = "1234321";
int b = int.parse(a);
float c = 22f/ 7f;
double d =(double)c;
Console.WirteLine("string {0}",a);
Console.WriteLine("int.parse() b {0}",b);
Console.WriteLine("float c {0}",c);
Console.WrtieLine("double{0}",d);
}
}
using System;
class carTest
{
public static void Main()
{
char a = 'A';
char b = '한';
char c = '한국'; // char 형 변수는 문자하나만 저장가능
Console.WriteLine("{0}",a);
Console.WriteLine("{0}",b);
}
}
using System;
class boxingTest
{
public static void Main()
{
int i = 123;
object j = i;
i = 456;
int k = (int)j;
object a = 111;
object b = 2;
object c = (int)a * (int)b;
Console.WriteLine("{0}",i);
Console.WriteLine("{0}",j);
Console.WriteLine("{0}",k);
Console.WriteLine("{0}", c);
}
}
using System;
class boolTest
{
public static void Main()
{
int i = 3;
int j = 4;
bool a = (i < j);
bool b = (i < j);
bool c = (i == j);
Console.WriteLine("{0}", i);
Console.WriteLine("{0}", j);
Console.WriteLine("{0}", a);
Console.WriteLine("{0}", b);
Console.WriteLine("{0}", c);
}
}
'Writer > WarmingUp Code' 카테고리의 다른 글
눈물의 소스 박스형 for와 if 사용 첨부 상철 상봉 오윤 (0) | 2008.10.09 |
---|---|
소스 복습 (0) | 2008.10.08 |
객체지향 소스 (0) | 2008.10.07 |
성적출력 (0) | 2008.10.07 |
소스연습 (0) | 2008.10.06 |
프로퍼티 웜업소스 (0) | 2008.10.05 |
복습 (0) | 2008.10.02 |
클래스 구조체 (0) | 2008.10.01 |