作业帮 > 综合 > 作业

C 程序 神样难题.这是我最后一个作业.是要求自己自由发挥.编出一个C程序.我实在是无语了.写了一个老师说完全不对.求救

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/16 11:25:15
C 程序 神样难题.
这是我最后一个作业.是要求自己自由发挥.编出一个C程序.我实在是无语了.写了一个老师说完全不对.求救大神了.他自己给的例子是 How does the trajectory of a ping-pong serve depend on how the ball is struck?就是一开始乒乓球发射如何影响乒乓球发出去后的轨迹.啊糊涂了.我已经绝望了.编不出其他了.
要求
What question are you answering?
Define the inputs you have chosen to vary 定义输入的变量
Define the outputs your program calculates 定义输出的计算结果
Briefly outline how you designed your program 简短说出你如何设计这个程序
Show your results in the form of graphs and summarize your conclusions 你答案的图形给你什么结论
List the references you found most useful.列出最有用的参考资料.
我们的作业基本都用这3个.
#include
#include
#include
你的代码输入变量是随即生成的.输出的结果是ABC三个人的排名, 输出到DATA_FILE("abc.dat").
每行x y z 其中x y z分别为A B C的名次 , 名次取值范围为1,2,3.
因为100看起来太密集,改成了100/3.
为减少重复,srand从sub1中移到main.
sub2的排序和比较部分没有认真看.你自己再检查一下.
画图:
gnuplot> set term png
gnuplog> set output "abc.png"
gnuplot> plot "abc.dat" using 1 title "A" with lines, "abc.dat" using 2 title "B" with lines, "abc.dat" using 3 title "C" with lines
#include
#include
#include
#define DATA_FILE "abc.dat"
#define N 100/3
typedef struct card
{
int num;//A 1~10 J Q K
int clr;//0.spade,1.heart,2.club,3.diam
}Crd;
static int count=0;//申明一个全局静态变量,当一副牌发完4次以后,重新洗牌.
char clr[4][5]={"spad","hear","club","diam"};
char person[3][3]={"A","B","C"};
void showCards(Crd array[3][4])
{
int i,j;
for(i=0;i