다시 부탁좀 드릴게요 ㅜ
올리브
#include stdio.h
#include math.h
#define MAX_SIZE 101
#define SWAP(x,y,t) ((t) = (x), (x)=(y), (y)=(t))
void sort(int [],int);
void main(void)
{
int i,n;
int list[MAX_SIZE];
printf(Enter the number of numbers to generate: );
scanf(%d,&n);
if(n1||nMAX_SIZE){
fprintf(stderr, Improper value of n\n);
exit(EXIT_FAILURE);
}
for(i=0; in; i++){
list[i] = rand() % 1000;
printf(%d ,list[i]);
}
sort(list,n);
printf(\n Sorted array:\n );
for(i=0; in; i++)
printf(%d ,list[i]);
printf(\n);
}
void sort(int list[], int n)
{
int i, j, min, temp;
for(i=0; in-1; i++)
{
min = i;
for(j=i+1; jn; j++)
if(list[j] list[min])
min =j;
SWAP(list[i],list[min],temp);
}
}이걸 selectionSort.h 로 저장햇구요 #include stdio.h
#include time.h
#include selectionSort.h
#define MAX_SIZE 10001
void main(void)
{
int i, n, step = 100;
int a[MAX_SIZE];
double duration;printf( n repetitions time\n);
for (n=0 ; n=10000 ; n+=step)
{
long repetitions = 0;
clock_t start = clock();
do
{
repetitons++;
for(i=0 ; in ; i++)
a[i] = n-i;
sort(a, n);
}while (clock() - start 10000); duration = ((double) (clock() - start))
/ CLOCKS_PER_SEC;
duration /= repetitions;
printf(%6d %9d %f\n, n, repetitions, duration);
if (n == 1000) step = 1000;
}
}
이걸 해봣는데 에러가 더 많이...ㄷㄷ;; 헤더를 만드는방식이 잘못됫나요??;;이거 책보고 하는데도 안되니깐 진짜 미칠것같네요 ㅜㅜ
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2701151 | 사이트작업시 inputbox 가 readonly 형태표시 어떻게 하시나요? (1) | 찬내 | 2025-07-11 |
2701123 | 간단한 select 질문입니다 (3) | 천사의눈물 | 2025-07-11 |
2701061 | 비베질문.. | 똘끼 | 2025-07-10 |
2701034 | 메일폼 내 script 삽입가능한 방법 없을까요.. (2) | 마음새 | 2025-07-10 |
2701008 | 분명히 버튼을 만들었는데 액션이 안걸립니다. (3) | 재찬 | 2025-07-10 |
2700923 | 전체중앙정렬&독타입&쿼크모드 ㅜㅠ (8) | 푸른들 | 2025-07-09 |
2700893 | 질문드리겠습니다. | 도도한 | 2025-07-09 |
2700793 | 무비클립에 마우스 오버시 랜덤으로 효과음 나기는 어떻게 ;; (1) | 바닐라 | 2025-07-08 |
2700741 | 웹전송? (2) | 연와인 | 2025-07-07 |
2700686 | 카테고리 호버시 세부카테고리 보이게하는 것, css로만 가능할까요?? (3) | 다힘 | 2025-07-07 |
2700658 | 메타태그 질문드립니다..ㅠㅠ;;; | 모해 | 2025-07-07 |
2700632 | 외부에서 이미지 파일을 불러와야 합니다. 도와주세요. (4) | 에일린 | 2025-07-06 |
2700579 | (air + as3) smtp 이용해서 첨부파일 포함해서 메일 보내기 | 물보라 | 2025-07-06 |
2700524 | 클릭시 밑에 메뉴 나오게 (4) | 새솔 | 2025-07-05 |
2700505 | activex를 비쥬얼6.0으로 만들었는데요 비스타 배포시에 안되서 질문드립니다 (3) | 참이 | 2025-07-05 |
2700452 | c언어에서... 자료형 구분.... (3) | 시내 | 2025-07-05 |
2700422 | 버전에 관해 질문 | 라온제나 | 2025-07-04 |
2700393 | mysql이 갑자기!!!!!!!!!!!!!!!에러가;; (2) | 소미 | 2025-07-04 |
2700359 | 3.0 ) SimpleButton 상태 강제 변경 (3) | 희선 | 2025-07-04 |
2700304 | ie8 전용핵 문의 (3) | 여자 | 2025-07-03 |