using System;
namespace atoi_itoa
{
class MainClass
{
public static void Main (string[] args)
{
int a = 123;
string b = a.ToString ();
Console.WriteLine (b);
float c = 3.15563f;
string d = c.ToString ();
Console.WriteLine (d);
string e = "1234567";
int f = int.Parse (e);
Console.WriteLine (f);
string g = "12.34567";
float h = float.Parse (g);
Console.WriteLine (h);
}
}
}
| cs |
2017년 2월 20일 월요일
C# - 데이터 형식 - 변환_atoi / itoa
C# - 데이터 형식 - Boxing / UnBoxing
using System;
namespace BoxingUnBoxing
{
class MainClass
{
public static void Main (string[] args)
{
int a = 123;
object b = (object)a;
int c = (int)b;
Console.WriteLine (a);
Console.WriteLine (b);
Console.WriteLine (c);
double x = 3.142352;
object y = x;
double z = (double)y;
Console.WriteLine (x);
Console.WriteLine (y);
Console.WriteLine (z);
}
}
}
| cs |
C# - 데이터 형식 - object
using System;
namespace Object
{
class MainClass
{
public static void Main (string[] args)
{
object a = 123;
object b = 3.141412532643263452354234m;
object c = true;
object d = "hello";
Console.WriteLine (a);
Console.WriteLine (b);
Console.WriteLine (c);
Console.WriteLine (d);
}
}
}
| cs |
c# - 데이터 형식 - 기본형
using System;
namespace NumbericTypes
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
byte B_TempValue = byte.MaxValue;
sbyte SB_TempValue = sbyte.MaxValue;
short S_TempValue = short.MaxValue;
ushort US_TempValue = ushort.MaxValue;
int IN_TempValue = int.MaxValue;
uint UI_TempValue = uint.MaxValue;
long LO_TempValue = long.MaxValue;
ulong UL_TempValue = ulong.MaxValue;
char CH_TempValue = char.MaxValue;
Console.WriteLine ("byte = {0}", B_TempValue);
Console.WriteLine ("sbyte = {0}", SB_TempValue);
Console.WriteLine ("short = {0}", S_TempValue);
Console.WriteLine ("ushort = {0}", US_TempValue);
Console.WriteLine ("int = {0}", IN_TempValue);
Console.WriteLine ("uint = {0}", UI_TempValue);
Console.WriteLine ("long = {0}", LO_TempValue);
Console.WriteLine ("ulong = {0}", UL_TempValue);
Console.WriteLine ("char = {0}", CH_TempValue);
}
}
}
| cs |
피드 구독하기:
덧글 (Atom)