본문 바로가기

Writer/WarmingUp Code

소스 복습

반응형


/*using System;

class Absolute
{
 public static void Main()
 {
  GetAbsolute(-23);
  GetAbsolute(392.3f);
  GetAbsolute(-293.2343337);
 }

 private static void GetAbsolute(int a)
 {
  int b = 0;

  if (a < 0) b = b * -1;
  else b = a;
  Console.WriteLine("{0}{1}",a,b);

 }
 private static void GetAbsolute(float a)
 {
  float b = 0;

  if (a < 0) b = b * -1;
  else b = a;
  Console.WriteLine("{0}{1}", a, b);

 }
 private static void GetAbsolute(double a)
 {
  double b = 0;

  if (a < 0) b = b * -1;
  else b = a;
  Console.WriteLine("{0}{1}", a, b);

 }
}

*/
/*
using System;

class Absolute
{
 public static void Main()
 {
  GetAbsolute(-23);   //int 형
  GetAbsolute(392.3f);  //float 형
  GetAbsolute(-293.2342525); //dobule 형
 }

 private static void GetAbsolute(int a)
 {
  int b = 0;

  if (a < 0)
   b = a * 1;
  else b = a;

  Console.WriteLine("{0}{1}",a,b);

 }

 private static void GetAbsolute(float a)
 {
  float b = 0;

  if (a < 0)
   b = a * 1;
  else b = a;

  Console.WriteLine("{0}{1}", a, b);

 }

  private static void GetAbsolute(double a)
 {
  double b = 0;

  if (a < 0)
   b = a * 1;
  else b = a;

  Console.WriteLine("{0}{1}",a,b);

 }


}

*/
/*using System;

class Average
{
 public static void Main()
 {
  float result = GetAvg(177.3f, 173.0f , 168.5f);
  Console.WriteLine("{0}",result);
 }

 private static float GetAvg(params float[] args)
 {
  float mean=0;
  
  for (int i = 0; i < args.Length; i++ )
  {
   mean = mean + args[i];
  }
  mean = mean / args.Length;
  return mean;
 }
}

*/
/*using System;

class Average
{
 public static void Main()
 {
  float result = GetAvg(177.3f, 172.1f ,165.3f);
  Console.WriteLine("평균키는 {0}입니다 ",  result);
 }

 private static float GetAvg(params float[] args)
 {
  float mean = 0;
  for (int i = 0; i < args.Length; i++ )
  {
   mean += args[i];
  }

  return mean / args.Length;
 }
}
*/
/*
 * using System;

class Average
{
 public static void Main()
 {
  float result = GetAverage(177.3f, 172.1f, 165.3f);
  Console.WriteLine("평균 키는 {0:f1}cm입니다", result);
 }

 private static float GetAverage(params float[] args)
 {
  float mean = 0;

  for (int i = 0; i < args.Length; i++ )
  {
   mean += args[i];
  }
  return mean / args.Length;
 }

}
*/
/*using System;

class outExc
{
 public static void Main()
 {
  float Won =0;
  float Dollar , Yen;
  
  Console.WriteLine("환산할돈 입력 : ");
  Won = Convert.ToSingle(Console.ReadLine());
  Exchange(Won, out Dollar, out Yen);
  Console.WriteLine("{0}",Dollar);
  Console.WriteLine("{0}{1}",Yen,Dollar);
  


 }

 private static void Exchange(float Won, out float Dollar, out float Yen)
 {
   Dollar= Won /1200;
   Yen=Won /10;
 }
}
*/
/*
using System;

class outExc
{
 public static void Main()
 {
  float won = 0;
  float Dollar;
  float Yen ;

  Console.WriteLine("환산할 돈이 얼마입니까?");
  won=Convert.ToSingle(Console.ReadLine());
  Exchange(won, out Dollar,out Yen);
  Console.WriteLine("{0:f2}",Dollar);
  Console.WriteLine("{0:f2}",Yen);

  
 }

 private static void Exchange(float won, out float Dollar, out float Yen)
 {
  Dollar = won / 1200;
  Yen=won/10;
 }
}

*/

 

/*
using System;

class returnExc
{
 public static void Main()
 {
  float won = 0;
  Console.WriteLine("환산할 값을 입력해주세요 ");
  won=Convert.ToInt16(Console.ReadLine());

  Console.WriteLine("{0}", toDollar(won));
  Console.WriteLine("{0}", toYen(won));
 }

 private static float toYen(float won)
 {
  return won/10;
 }

 private static float toDollar(float won)
 {
  return won/1200;
 }
}
*/
/*
using System;

class returnExc
{
 public static void Main()
 {
  float won = 0;
  Console.WriteLine("환산할돈이 얼마?? 원:");

  won=Convert.ToSingle(Console.ReadLine());
  Console.WriteLine("{0}", toDollar(won));
  Console.WriteLine("{0}", toYen(won));

 }

 private static float toYen(float won)
 {
  return won /10;
 }

 private static float toDollar(float won)
 {
  return won / 1200;
 }
}
*/

/*
using System;

class refSwap
{

 public static void Main()
 {
  int a = 3;
  int b = 4;

  Console.WriteLine("{0}{1}",a,b);
  Swap(ref a, ref b);
  Console.WriteLine("{0}{1}", a, b);
 }

 private static void Swap(ref int a, ref int b)
 {
  int temp = a;
  a = b;
  b = temp;
  Console.WriteLine("{0}{1}",a,b);
 }
}
*/

/*using System;

class refSwap
{
 public static void Main()
 {
  int a = 3;
  int b = 4;

  Console.WriteLine("{0}{1}",a,b);
  Swap(ref a, ref b);
  Console.WriteLine("{0}{1}",a,b);
 }

 private static void Swap(ref int a, ref int b)
 {
  int temp = a;
  a = b;
  b = temp;
  Console.WriteLine("{0}{1}",a,b);
 }


}

*/
/*

using System;
class vlaueSwap
{

 public static void Main()
 {
  int a = 3;
  int b = 4;

  Console.WriteLine("{0}{1}",a,b);
  Swap(a,b);
  Console.WriteLine("{0}{1}",a,b);
 }

 private static void Swap(int a, int b)
 {
  int temp = a;
  Console.WriteLine("{0}{1}_1", a, b);//34
  a = b;
  Console.WriteLine("{0}{1}_2", a, b);//44
  b = temp;
  Console.WriteLine("{0}{1}_3", a, b);//43
 }
}
*/
/*
using System;

class valueParm
{
 public static void Main()
 {
  int a = 3;
  int b = 4;
  int value = plus(a, b);
  Console.WriteLine("3+4={0}",value);
 }

 private static int plus(int a, int b)
 {
  return a + b;
 }


}

*/

/*

using System;

class Scope
{
 static int a = 0;

 public static void Main()
 {
  Console.WriteLine("Test 클래스의 a의값은 {0}입니다 ",a);
  Func1();
  Func2();
  Console.WriteLine("Test 클래스의 a의값은 {0}입니다 ", a);
 }

 private static void Func2()
 {
  int a = 3;
  Console.WriteLine("Test 클래스의 a의값은 {0}입니다 ", a);
 }

 private static void Func1()
 {
  int a = 7;
  Console.WriteLine("Test 클래스의 a의값은 {0}입니다 ", a);
 }
}

 *
 *
 *
 * */
/*


using System;

class funPlus
{
 public static void Main()
 {
  int value = Plus(3, 4);
  Console.WriteLine("3+4={0}",value);
 }

 private static int Plus(int p, int p_2)
 {
  int c = p + p_2;
  return c;
 }
}

*/
/*

using System;

class funcPlus
{
 public int plus(int a, int b)
 {
  int c = a + b;
  return c;
 }

 public static void Main()
 {
  funcPlus fps = new funcPlus();
  int value = fps.plus(3, 4);
  Console.WriteLine("3+4={0}", value);
 }


}

*/

 


/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 * using System;

class outExc
{
 public static void Exchange(float won, out float Dollar, out float Yen)
 {
  Dollar = won/1200;
  Yen = won /10;
  
 }

 public static void Main()
 {
  float won = 0;
  float Dollar = 0;
  float Yen = 0;

  Console.WriteLine("환산할 돈이 얼마입니까? 원으로 입력 : ");
  won=Convert.ToSingle(Console.ReadLine());
  Exchange(won, out Dollar , out Yen);
  Console.WriteLine("님께서 입력하신 액수는 미화로 {0:f1}달러 ",Dollar);
  Console.WriteLine("님께서 입력하신 액수는 일화로 {0:f1}엔 ",Yen);

 }

}


*/

'Writer > WarmingUp Code' 카테고리의 다른 글