|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
一个快速排序代码如下:
- #include<stdio.h>
- #define MaxSize 100
- typedef int KeyType;
- typedef int ElemType;
- typedef struct{
- KeyType key;
- ElemType data;
- }SqType;
- void QuickSort(SqType R[], int s, int t){
- int l = s, r = t;
- SqType tmp;
- if(s<t){
- tmp = R[l];
- while(l!=r){
- while(r>l && R[r].key>=tmp.key)
- r--;
- R[l] = R[r];
- while(l<r && R[l].key<=tmp.key)
- l++;
- R[r] = R[l];
- }
- R[l] = tmp;
- QuickSort(R, s, l-1);
- QuickSort(R, l+1, t);
- }
- }
- int main(){
- SqType R[MaxSize];
- KeyType A[MaxSize];
- int N, i;
- scanf("%d", &N);
- for(i=0;i<N;i++)
- scanf("%d", &A[i]);
- for(i=0;i<N;i++)
- R[i].key = A[i];
- QuickSort(R, 0, N-1);
- for(i=0;i<N;i++)
- printf("%d\n", R[i].key);
- return 0;
- }
复制代码
报错信息如下:
Comain.c:1:20: fatal error: iostream: No such file or directory
#include <iostream>
^
compilation terminated.
不清楚你是怎么操作的,编译器编译的源文件不对,编译的不是你贴出来的这个代码
|
|