[ Source ]
using System;
namespace ex_2
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
protected class Swap
{
public void Swapping( int numA, int numB )
{
Console.WriteLine("Before : First : " + numA + " Sencond : " + numB);
int temp;
temp = numA;
numA= numB;
numB=temp;
Console.WriteLine("After : First : " + numA + " Sencond : " + numB);
}
public void Swapping( double numA, double numB )
{
Console.WriteLine("Before : First : " + numA + " Sencond : " + numB);
double temp;
temp = numA;
numA= numB;
numB=temp;
Console.WriteLine("After : First : " + numA + " Sencond : " + numB);
}
public void Swapping( char numA, char numB )
{
Console.WriteLine("Before : First : " + numA + " Sencond : " + numB);
char temp;
temp = numA;
numA= numB;
numB=temp;
Console.WriteLine("After : First : " + numA + " Sencond : " + numB);
}
}
[STAThread]
static void Main()
{
Swap h_sw = new Swap();
Console.WriteLine("====[Change integer]=====================================");
h_sw.Swapping(3,7);
Console.WriteLine("====[Change Float]=======================================");
h_sw.Swapping(1.1,3.3);
Console.WriteLine("====[Change Character]==================================");
h_sw.Swapping('A','Z');
}
}
}
댓글
댓글 쓰기