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

개념 : 


1. 원형 double atan2(double y, 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 dResultATan = 0.0;


//dDegree = 45.0f;


double dX = 1.3;

double dY = 1.9;


dRadian = (PI / 180) * 45;


dResultATan = atan2(dY, dX);


printf("X : %g, Y: %g \n", dX, dY);

printf("atan : %f\n", dResultATan);


return 0;

}


/// 아크 탄제트를 구하는 함수.



결과:




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 크기의 광고 코드만 넣을 수 있습니다.

개념 : 


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. time.h 에 포함되어 있는 ctime 함수를 사용합니다. 

2. 원형 : char* ctime(const time_t *timer)


소스 코드 : main.c

//

//  main.c

//  128

//

//  Created by 이준모 on 2018. 2. 8..

//  Copyright © 2018년 이준모. All rights reserved.

//


#include <stdio.h>

#include <time.h>

int main(int argc, const char * argv[])

{

    // insert code here...

    time_t now;

    time(&now);

    

    printf("현재 날짜 및 시간 : %s", ctime(&now));

    return 0;

}


결과:


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

개념 :


1. 원형 : void _ftime(struct _timeb *timeptr);


2. 구조체 : 

struct _timeb

{

time_t    time;          //time_t

unsigned    short;    millitm // 1/1000초

short    timezone; //세계 표준시와 현지와의 분수의 차이

short    dstflag;    //써머타임 적용 시 0이 아닌 값, 그밖에는 0 

};




소스코드 : main.c


#include <stdio.h>

#include <time.h>

#include <sys/timeb.h>

#include <memory.h>

int main(int argc, const char * argv[])

{

    struct timeb tb; // _timeb use windows 

    struct tm t;

    

    ftime(&tb); // _ftime use windows

    

    t= *localtime(&tb.time);

    

    printf("현재 날짜 및 시간 : %4d. %d. %d. %d. %d. %d. %d \n",t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t. tm_sec, tb.millitm);

    return 0;

}




결과:




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

개념 : 


1. 원형: struct tm* localtime(const time_t *time);


2. 파라메터 *time을 기준으로 struct tm* 으로 반환하여줍니다.


3. struct tm

#ifndef _TM_DEFINED

struct tm {

        int tm_sec;     /* seconds after the minute - [0,59] */

        int tm_min;     /* minutes after the hour - [0,59] */

        int tm_hour;    /* hours since midnight - [0,23] */

        int tm_mday;    /* day of the month - [1,31] */

        int tm_mon;     /* months since January - [0,11] */

        int tm_year;    /* years since 1900 */

        int tm_wday;    /* days since Sunday - [0,6] */

        int tm_yday;    /* days since January 1 - [0,365] */

        int tm_isdst;   /* daylight savings time flag */

        };

#define _TM_DEFINED




소스코드 : main.c


#include<stdio.h>

#include<time.h>



int main(void)

{

time_t now;

struct tm t;


time(&now);


t = *localtime(&now);


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


system("pause");

return 0;

}





결과:


+ Recent posts