kaiyuan941014 2014-12-12 00:52 采纳率: 0%
浏览 1834
已结题

求大神帮忙写到c语言的程序,关于体育场建筑物的!!谢谢

In this exercise you will design a structure in C that models a Major League Baseball stadium. You
will also write several supporting functions and methods that process and act on that data. Additional
details are provided in the stadium.h file.
The first step will be to design your structure(s). You will need to decide what fields and data types
should be included in this structure. At a minimum, you should support the following pieces of data:
• Stadium name
• Team name
• City
• State
• Year Built
• Latitude (scale: ["180, 180], negative is southern hemisphere)
• Longitude (scale: ["180, 180], negative is western hemisphere)
For completeness, we repeat how to compute the air distance between two latitude/longitude points
using the Spherical Law of Cosines:
d = arccos (sin('1) sin('2) + cos('1) cos('2) cos(")) • R
where
• '1 is the latitude of location A, '2 is the latitude of location B
• " is the di↵erence between location B’s longitude and location A’s longitude
• R is the (average) radius of the earth, 6,371 kilometers
Note: the formula above assumes that latitude and longitude are measured in radians r, "⇡  r  ⇡.
To convert from degrees deg ("180 < deg <180) to radians r, you can use the simple formula:
r = (deg /180)*PI

/**

  • Structure that models a Major League Baseball Stadium */ typedef struct { //TODO } Stadium;![]

typedef enum {
NAME,
TEAM,
AGE,
AGE_NEWEST,
STATE_CITY,
LATITUDE,
LONGITUDE,
} Order;

/**

  • A builder function to create an instance of a Stadium with
  • the provided values.
    */ Stadium * createStadium(const char *name, const char *teamName, const char *city, const char *state, int yearBuilt, double latitude, double longitude);

/**

  • A function to convert a Stadium instance to a human-readable
  • string representation. */ char * stadiumToString(const Stadium *s);

/**

  • Returns the air distance (using the Spherical Law of Cosines
  • between the two stadiums based on their latitude/longitude. */ double getAirDistance(const Stadium *s1, const Stadium *s2);

/**

  • Returns the total air distance between each contiguous
  • stadium in the given array containing n stadiums. */ double getAirDistances(const Stadium *stadiums, int n);

/**

  • Comaprator function that orders stadiums by their name (alphabetic order) */ int cmpStadiumByName(const void *s1, const void *s2);

/**

  • Comaprator function that orders stadiums by their team name (alphabetic order) */ int cmpStadiumByTeamName(const void*s1, const void*s2);

/**

  • Comaprator function that orders stadiums by their age (oldest first) */ int cmpStadiumByAge(const void*s1, const void*s2);

/**

  • Comaprator function that orders stadiums by their age (newest first) */ int cmpStadiumByAgeNewestFirst(const void*s1, const void*s2);

/**

  • Comaprator function that orders stadiums by first by their state
  • then by their city (alphabetic order) */ int cmpStadiumByStateCity(const void*s1, const void*s2);

/**

  • Comaprator function that orders stadiums by their name latitude, (south to north) */ int cmpStadiumByLatitude(const void*s1, const void*s2);

/**

  • Comaprator function that orders stadiums by their name longitude (west to east) */ int cmpStadiumByLongitude(const void*s1, const void*s2);

/**

  • A function that sorts the given array of stadiums (containing n elements) according
  • to the specified order.
    */ void sortStadiums(Stadium *stadiums, int n, Order order);
  • 写回答

2条回答

  • lxq_xsyu 博客专家认证 2014-12-15 10:23
    关注

    这很考验英语功底啊!!

    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况