[ create a new paste ] login | about

Link: http://codepad.org/Tfs2uwRb    [ raw code | output | fork ]

C, pasted on Jan 7:
/* 
 * File:   main.c
 * Author: XXXX
 *
 * Created on 2013/01/08, 0:22
 */
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#define N 100.0

void calc();
void calc2();
int main(int argc, char** argv){
    calc();
    calc2();
    return (EXIT_SUCCESS);
}
void calc(){
    double ans, angle;
    angle = M_PI / N;
    ans = sin(angle) * cos(angle) * N;
    printf("100角形の面積:%2.10f\n", ans);
    
}
void calc2(){
    printf("手計算の面積(Π=3.14):%2.10f\n", (1.0 * 1.0 * 3.14));
}


Output:
1
2
3
In function `calc':
undefined reference to `sin'
undefined reference to `cos'


Create a new paste based on this one


Comments: