質問編集履歴
2
サイトURLの追加
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ### 前提・実現したいこと
         
     | 
| 
       2 
     | 
    
         
            -
            paiza.ioでdrand48()を実行したいです。
         
     | 
| 
      
 2 
     | 
    
         
            +
            paiza.io[こちらのサイト](https://paiza.io/ja/projects/new)でdrand48()を実行したいです。
         
     | 
| 
       3 
3 
     | 
    
         
             
            ### 発生している問題・エラーメッセージ
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            ```
         
     | 
1
具体的なプログラムの追加
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -5,4 +5,36 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
            ```
         
     | 
| 
       6 
6 
     | 
    
         
             
            Main.c:166:5: warning: implicit declaration of function 'drand48' is invalid in C99 [-Wimplicit-function-declaration]
         
     | 
| 
       7 
7 
     | 
    
         
             
                    r =drand48();
         
     | 
| 
      
 8 
     | 
    
         
            +
            ```
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ###追記
         
     | 
| 
      
 11 
     | 
    
         
            +
            参考プログラムを作成いたしました。
         
     | 
| 
      
 12 
     | 
    
         
            +
            drand48()で5回乱数を発生させるプログラムを記述いたしました。こちらをpaiza.ioで実行させるためにはどうすれば良いでしょうか?
         
     | 
| 
      
 13 
     | 
    
         
            +
            ```C
         
     | 
| 
      
 14 
     | 
    
         
            +
            #include <stdio.h>
         
     | 
| 
      
 15 
     | 
    
         
            +
            #include <stdlib.h>
         
     | 
| 
      
 16 
     | 
    
         
            +
            #include <time.h>
         
     | 
| 
      
 17 
     | 
    
         
            +
            int main()
         
     | 
| 
      
 18 
     | 
    
         
            +
            {
         
     | 
| 
      
 19 
     | 
    
         
            +
            	double x;
         
     | 
| 
      
 20 
     | 
    
         
            +
            	int i1;
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            	srand48(time(0));   // 初期化
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            	for (i1 = 0; i1 < 5; i1++) {
         
     | 
| 
      
 25 
     | 
    
         
            +
            		x  = drand48();   // 乱数の生成
         
     | 
| 
      
 26 
     | 
    
         
            +
            		printf("%f\n", x);
         
     | 
| 
      
 27 
     | 
    
         
            +
            	}
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            	return 0;
         
     | 
| 
      
 30 
     | 
    
         
            +
            }
         
     | 
| 
      
 31 
     | 
    
         
            +
            ```
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            ###追記したプログラムでのエラーメッセージ 
         
     | 
| 
      
 34 
     | 
    
         
            +
            ```
         
     | 
| 
      
 35 
     | 
    
         
            +
            Main.c:9:2: warning: implicit declaration of function 'srand48' is invalid in C99 [-Wimplicit-function-declaration]
         
     | 
| 
      
 36 
     | 
    
         
            +
                    srand48(time(0));   // 初期化
         
     | 
| 
      
 37 
     | 
    
         
            +
                    ^
         
     | 
| 
      
 38 
     | 
    
         
            +
            Main.c:12:8: warning: implicit declaration of function 'drand48' is invalid in C99 [-Wimplicit-function-declaration]
         
     | 
| 
      
 39 
     | 
    
         
            +
                            x  = drand48();   // 乱数の生成
         
     | 
| 
       8 
40 
     | 
    
         
             
            ```
         
     |