c言語のプログラムの課題で、 クイックソートプログラムとバブルソートプログラムについて,同一のデータについて実行時間を測定して比較し考察せよ.データ数が,5 千個,1 万個,2 万個,4 万個,8 万個の 5 つの場合について,それぞれ実行時間を計測する.比較,交換の回数を計数するプログラムは削除すること.データは、random()を使って生成する。というような問題が出てソースコードを作ったのですが、どちらのプログラムも fatal error: 'stdafx.h' file not foundというエラーが出てしまい原因がわかりません。原因を教えてくださると助かります。 ソースコード バブルソート #include <stdafx.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #define NUM 40000 void bubble_sort( int a[] ); void quick_sort( int a[], int left, int right ); void swap( int*,int*): int n_comp,n_exchange; void main() { int a[NUM]; time_t start,end; start = clock(); for (int i=0; i<NUM; i++ ){ a[i]=random(); } end = clock(); printf("計算時間は%.3f秒です¥n¥n",float(end-start)/CLOCKS_PER_SEC); } クイックソート #include <stdafx.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #define NUM 40000 void bubble_sort( int a[] ); void quick_sort( int a[], int left, int right ); void swap( int*,int*); int n_comp,n_exchange; void main() { int a[NUM]; time_t start,end; start = clock(); for (int i=0; i<NUM; i++ ){ a[i]=random(); } start=clock(); quick_sort(a,0,NUM-1); end = clock(); printf("計算時間は%.3f秒です¥n¥n",float(end-start)/CLOCKS_PER_SEC); }
C言語関連