336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

개념 : 


1. 원형 double asin(double x)



소스코드:


#include<stdio.h>

#include<math.h>


int main(void)

 const double PI = 3.141592653; 

 double dDegree = 0.0;

 double dRadian = 0.0; 

 double dResultASin = 0.0; 


 dDegree = 45.0f; 

 dRadian = (PI / 180) * 45;

 dResultASin = asin(dRadian);


 printf("Degree : %f\n", dDegree);

 printf("Radian : %f\n", dRadian); 

 printf("asin : %f\n", dResultASin);


 return 0;

}



결과:




336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

핵심 : C#의 문자열 개념과 선언및 초기화


소스코드 : program.cs


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace example_array

{

    class Program

    {

        static void Main(string[] args)

        {

            //배열을 선언

            char[] name = new char[10];

            name[0] = 'J';

            name[1] = 'u';

            name[2] = 'n';

            name[3] = 'm';

            name[4] = 'o';

            name[5] = ' ';

            name[6] = 'L';

            name[7] = 'e';

            name[8] = 'e';

            name[9] = '\0';


            //char 배열을 출력해본다.

            Console.WriteLine(name);/// Junmo Lee

                                    /// 

            //배열 선언과 동시화 초기화

            int[] Tag = new int[10] { 11, 22, 33, 44, 55, 66, 77, 88, 99, 1010 };


            foreach(int n in Tag)

            Console.Write(n); //1122334455667788991010


            Console.WriteLine("");//개행


            //다차원 배열 선언과 초기화 

            int[,] array = new int[2, 2] { { 5, 6}, {7,8 } };


            foreach (int n in array) 

                Console.Write(n);// 5678 순차적으로 출력


            Console.WriteLine("");//개행


            //역순으로 출력

            for(int i = 1 ; i>=0 ; i--)

            {

                for(int g = 1 ; g >= 0 ; g--)

                {

                    Console.Write(array[i,g]);// 8765

                }

            }


        }

    }

}


결과


'Programing C# > C# Basic grammar' 카테고리의 다른 글

06 다차원 배열  (0) 2019.05.11
04 문자와 문자열  (0) 2018.02.24
03 기본변수들 출력  (0) 2018.02.19
02 기본 변수 출력  (0) 2018.02.18
01 Hello World  (0) 2018.02.18
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

개념 : 


1. 원형 double sin(double x)



소스코드:


#include<stdio.h>

#include<math.h>


int main(void)

double x;


x = sin(1);


printf("sin(1) : %g\n", x);


system("pause");

return 0;

}



결과:



336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

개념 : 


1. 원형 : size_t strftime(char *strDest, size_t maxsize, const char *format, const struct tm *timeptr)



소스코드:


#include<stdio.h>

#include<time.h>


int main(void)

{

time_t now;

struct tm t;

char buff[100];


now = time(NULL);

t = *localtime(&now);


strftime(buff, sizeof(buff), "%Y-%m-%d %I : %M : %S %p", &t);


puts(buff);


system("pause");

return 0;

}



결과:






336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

개념 : 


1. 원형 : char* asctime(const struct tm *timeptr)


소스코드 : 


#include<stdio.h>

#include<time.h>


int main(void)

{

time_t now;

struct tm t;


now = time(NULL);

t = *localtime(&now);

puts(asctime(&t));


system("pause");

return 0;

}



결과:



336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

개념  : 

1. 원형 : double difftime(time_t timer1, time_t timer


소스코드 :  main.c

#include <stdio.h>

#include<time.h>


void main(void)

{


time_t s1, s2;

double gop;

int i;


time(&s1);


system("pause");


time(&s2);


printf("runnig time : %g (seconds)  \n", difftime(s2, s1));


system("pause");

}



결과 :





336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

개념 : 


1. 원형 :  time_t mktime(struct tm* timeptr)



소스코드 : main.c


#include<stdio.h>

#include<time.h>


int main(void)

{

time_t now;

struct tm t;


time(&now);

t = *localtime(&now);

t.tm_mday += 100;


mktime(&t);


printf("%s + 100 Days \n", ctime(&now));

printf("%4d . %d . %d . %d : %d : %d \n", t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);


system("pause");

return 0;

}



결과



336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

개념 

1. 문자(char)

1-1. C#에서 문자는 유니코드(Unicode) 문자 1개를 말한다.

1-2. 단일 인용 부호로 표기 합니다. example) char variable = 'c';

1-3. 한글, 한자등의 전각 문자도 문자형 변수에 대입할수 있다. example) char hanguleGa='가';


2. 문자열(string)

2-1. 복수의 문자열을 말합니다.

2-2 이중 인용 부호로 표기 합니다. example) string variable = "interesting string";

2-3 문자열의 결합은 + 로 할수 있습니다. (한쪽에 수치형int등으로 되어 있어도 문자로 적용합니다. ) 

example) string test = 3 + "월" + "입니다."  // 결과 :  3월입니다.




소스코드 : CharToString.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace _04charTostring

{

    class CharToString

    {

        static void Main()

        {

            char chVariable = '잔';

            int nVariable = 10;

            string strVariable = "Coffee";


            string strResult = strVariable + nVariable + chVariable;


            Console.WriteLine(strResult);

        }

    }

}



결과 : 


'Programing C# > C# Basic grammar' 카테고리의 다른 글

06 다차원 배열  (0) 2019.05.11
05 배열  (0) 2018.11.06
03 기본변수들 출력  (0) 2018.02.19
02 기본 변수 출력  (0) 2018.02.18
01 Hello World  (0) 2018.02.18
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

목표 : 

1. 기본 변수를 출력 해봅니다.


소스코드 : Program.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace _03_Variable

{

    class Program

    {

        static void Main(string[] args)

        {

            sbyte sbVariable = -128; // -128~127  8bit

            byte bVariable = 255; // 0~255  8bit

            short sVariable = -32768; // -32768~32767  16bit

            ushort usVariable = 65535; // 0~65535  16bit

            int nVariable = -2147483648; // -2147483648~2147483647 32bit

            uint unVariable = 4294967295; // 0~4294967295 32bit

            long lVariable = -922337036854775808; // -922337036854775808~922337036854775807 64bit

            ulong ulVariable = 18446744073709551615;// 0~18446744073709551615 64bit

            float fVariable = -1.99f;// +-1.5*10^-45~+-3.4*10^38 32bit

            double dVariable = -1.9999;// +-5*10^-324~+-1.7*10^308 64bit

            decimal dcVariable = 12345; // +-1*10^-28~+-7.9*10^28 128bit


            Console.WriteLine(sbVariable);

            Console.WriteLine(bVariable);

            Console.WriteLine(sVariable);

            Console.WriteLine(usVariable);

            Console.WriteLine(nVariable);

            Console.WriteLine(unVariable);

            Console.WriteLine(lVariable);

            Console.WriteLine(ulVariable);

            Console.WriteLine(fVariable);

            Console.WriteLine(dVariable);

            Console.WriteLine(dcVariable);

        }

    }

}



결과


'Programing C# > C# Basic grammar' 카테고리의 다른 글

06 다차원 배열  (0) 2019.05.11
05 배열  (0) 2018.11.06
04 문자와 문자열  (0) 2018.02.24
02 기본 변수 출력  (0) 2018.02.18
01 Hello World  (0) 2018.02.18
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

목표 : 

1. 기본 변수를 만들어서 출력 해봅니다.


소스 코드 : Program.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace _02_Variable

{

    class Program

    {

        static void Main(string[] args)

        {

            int a = 2;

            float b = 3.5f;


            Console.WriteLine(a);

            Console.WriteLine(b);

        }

    }

}



결과

'Programing C# > C# Basic grammar' 카테고리의 다른 글

06 다차원 배열  (0) 2019.05.11
05 배열  (0) 2018.11.06
04 문자와 문자열  (0) 2018.02.24
03 기본변수들 출력  (0) 2018.02.19
01 Hello World  (0) 2018.02.18

+ Recent posts