코드
2018.05.08 21:00

내가 만든 함수 모음집

조회 수 382 추천 수 0 댓글 4
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
라이선스 GPL v2

볼건 딱히 없습니다.


#include<stdio.h>
 
int abs(int a);
void sort(float a[],int n);
float pow(float a,float b);
 
 
int main()
{
 
}
 
float pow(float a,float b)
{
    int i,b1=b,a1=a;
 
    //printf("%d %d\n",a1,b1);
 
    for(i=0;i<b1-1;i++)
    {
        a*=a1;
        //printf("%f\n",a);
    }
 
    return a;
}
 
 
int abs(int a)
{
    if (a<0)
        return -a;
    else
        return a;
}
 
void sort(float a[],int n)
{
 
 
    int i,j,b,b2,min;
 
    for(i=0;i<n;i++)
    {
        min=9999999;
        b=i;
        for(j=i;j<n;j++)
        {
            if(min>a[j])
            {
                min=a[j];
                b=j;
            }
        }
        b2=a[i];
        a[i]=a[b];
        a[b]=b2;
    }
}

  • ?
    title: 대한민국 국기gimmepoint 2018.05.08 21:02
    근데 #include 하이퍼링크는 뭐죠?
  • profile
    네모 2018.05.09 10:31
    해시태그 때문에 그렇습니다.
    # 이랑 include 랑 한칸 띄워서 쓰시는게..!
  • profile
    제르엘 2018.05.09 11:08
    아니면 에디터에서 코드 형식을 적용하셔도 됩니다.
  • profile
    네모 2018.05.11 13:45

    pow 함수에 쓸데없는 변수가 많이 선언된거 같네요.


    float pow(float a, int b){

        float ret = a;

        for(b; b-1 > 0; b--){

            ret *= a;

        }

        return ret;

    }


    기존 함수도 b값에 소수점이 들어가면 올림해서 계산하니까...

    그냥 int로 받아서 작성해봤습니다.


  1. AWSCLI, in a single file (portable, linux)

    Date2021.04.10 Category코드 BySeia Views165
    Read More
  2. 도박 중독자를 위한 광고 차단 규칙

    Date2020.08.21 Category코드 By제르엘 Views294
    Read More
  3. 내가 만든 merge sort

    Date2018.05.17 Bytitle: 대한민국 국기gimmepoint Views370
    Read More
  4. 내가 만든 함수 모음집 2

    Date2018.05.12 Category코드 Bytitle: 대한민국 국기gimmepoint Views379
    Read More
  5. 미완성 받아쓰기 (C)

    Date2018.04.20 Category코드 Bytitle: 대한민국 국기gimmepoint Views380
    Read More
  6. 내가 만든 함수 모음집

    Date2018.05.08 Category코드 Bytitle: 대한민국 국기gimmepoint Views382
    Read More
  7. C언어 삼중자를 이용한 코드

    Date2018.07.22 Category코드 Bytitle: 황금 서버 (30일)humit Views410
    Read More
  8. Koa에서 자동으로 라우팅 채워주기

    Date2020.01.22 Category코드 BySeia Views437
    Read More
  9. JavaScript에서 파이썬 문자열 처리 함수 중 하나 (바인딩)를 구현

    Date2020.01.20 Category코드 BySeia Views463
    Read More
  10. [JS] 클라이언트단 GET Parameter

    Date2019.11.16 Category코드 ByHanam09 Views467
    Read More
  11. 아주 간단한 기초 C++

    Date2018.04.21 Category코드 By제르엘 Views477
    Read More
  12. c 이진트리 전,중,후위 알고리즘

    Date2018.04.24 Category코드 Bytitle: 대한민국 국기gimmepoint Views495
    Read More
  13. 파이선 셸에서 실행하면...?

    Date2018.07.22 Category코드 By제르엘 Views499
    Read More
  14. HEX를 RGB로, RGB를 HEX로 바꾸는 PHP 코드

    Date2018.05.05 Category코드 By네모 Views507
    Read More
  15. 내가 만든 사칙연산 계산기

    Date2018.05.11 Category코드 Bytitle: 대한민국 국기gimmepoint Views515
    Read More
  16. 링크 파싱 애드온용 스킨 (트위터 스타일)

    Date2017.10.03 Category자료 BySNAX Views516
    Read More
  17. [Python] 모 정부기관 사이트 파싱 후 PC 통신처럼 열람하고 싶은 게시글 번호를 입력하면 내용을 보여주는 소스 (허접)

    Date2018.09.14 Category코드 By이니스프리 Views559
    Read More
  18. Hello, World!를 출력해보자

    Date2018.04.21 Category코드 By네모 Views568
    Read More
  19. 매우 특이한 버그

    Date2018.06.05 Category코드 Bytitle: 대한민국 국기gimmepoint Views569
    Read More
  20. [1.8a] Bootstrap 'Panel' 위젯 스타일

    Date2017.08.09 Category자료 Bytitle: 은메달도다 Views602
    Read More
Board Pagination Prev 1 2 3 4 Next
/ 4