[求助]工程中文件的连接调用问题
看了好几天了,不知道哪错了,大家帮忙找找吧。#include "my.h"
int main(void)/main函数/
{
sort();
putout();
system("PAUSE");
return 0;
}
#ifndef _MY_H_/自定义头文件/
#define _MY_H_
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
struct city
{
char called[20];
}name[8];
struct city name[8]=
{
"Atlanta",
"Boston",
"Chicago",
"Denver",
"Hoston",
"LosAngeles",
"Miami",
"NewYork"
};
void sort();
void putout();
#endif
#include "my.h"/putout函数/
void putout()
{
int i;
for(i=0;i<8;i++)
{
printf(" %s ",name[i].called);
}
}
#include "my.h"/sort函数/
void sort()
{
int i, j, k;
char t[20];
printf("?????ò????????×?????\n");
for(i=0;i<8;i++)
{
printf(" %s ",name[i].called);
}
printf("\n");
for(i=0;i<7;i++)
{
k=i;
for(j=i+1;j<8;j++)
{
if(strcmp(name[j].called,name[k].called)>0)
{
k=j;
}
}
if(i != k)
{
strcpy(t,name[i].called);
strcpy(name[i].called,name[k].called);
strcpy(name[k].called,t);
}
}
}