【新手求助】为啥我的程序运行不显示值?

倒在四百页 倒在四百页 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <stdio.h>
#include <stdlib.h>

struct flex {
int count;
double average;
double scores[];
};
void makeFlex (struct flex *, int); //为struct申请内存并为元素赋值
void showFlex (struct flex *);//打印信息并释放内存

int main (void)
{
struct flex * pf;
makeFlex (pf, 5);
showFlex (pf);
makeFlex (pf, 10);
showFlex (pf);
return 0;
}
void makeFlex (struct flex * pf, int n)
{
int index;
double total = 0.0;
pf = malloc (sizeof (struct flex) + n * sizeof (double));
pf->count = n;
for (index = 0; index < pf->count; index++)
{
pf->scores[index] = 20.0 - index / (n / 5);
total += pf->scores[index];
}
pf->average = total / pf->count;
}
void showFlex (struct flex * pf)
{
int index;
printf ("Scores: ");
for (index = 0; index < pf->count; index++)
{
printf ("%g ", pf->scores[index]);
}
putchar ('\n');
free (pf);
}
...全文

相关推荐

新手求助RBF神经网络数据预测问题-数据.xls

新手求助RBF神经网络数据预测问题-数据.xls 本程序用前六个数据预测下一数据,前200组数据用于训练,用后80组数据进行预测,可预测结果为一个值,请大家指教: 源程序为: clc clear close all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %每五个数据整合, x=xlsread; n=length m=5; sum=0; j=1; x1=zeros); for k=1:m:n     for i=k:         sum=sum x;     end     x1=sum;     j=j 1;     sum=0; end j t=1:; figure plot;%,'d-m' hold on; grid on title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %归一化处理 [x2,mint,maxt] = premnmx figure plot;%,'d-m' hold on; grid on title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %输入数据 for k=1:1:200     p_train=[x2 x2 x2 x2 x2 x2]; 5*6     t_train=x2; 5*1 end     p_train=p_train'; %6*195     t_train=t_train'; %1*195 for z=1:1:81     p_test=[x2 x2 x2 x2 x2 x2];     t_test=x2; end      p_test=p_test';      t_test=t_test'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %建立 RBF 网络                      goal = 0.0001;                     % 训练误差的平方和 spread = 0.01;                     % 此值越大,需要的神经元就越少 MN = size;              % 最大神经元数 DF = 1;                            % 显示间隔 net = newrb; data_out=sim p_mse=mse figure plot hold on plot title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %预测并作图 y=sim y_mse=mse figure plot; hold on; plot title; legend;

weixin_39841365

cout不打印,不显示,不输出 怎么办?

解决cout不显示,不输出,不打印

lj_70596

新手求助RBF神经网络数据预测问题-历史开奖数据.xlsx

新手求助RBF神经网络数据预测问题-历史开奖数据.xlsx 本程序用前六个数据预测下一数据,前200组数据用于训练,用后80组数据进行预测,可预测结果为一个值,请大家指教: 源程序为: clc clear close all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %每五个数据整合, x=xlsread; n=length m=5; sum=0; j=1; x1=zeros); for k=1:m:n     for i=k:         sum=sum x;     end     x1=sum;     j=j 1;     sum=0; end j t=1:; figure plot;%,'d-m' hold on; grid on title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %归一化处理 [x2,mint,maxt] = premnmx figure plot;%,'d-m' hold on; grid on title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %输入数据 for k=1:1:200     p_train=[x2 x2 x2 x2 x2 x2]; 5*6     t_train=x2; 5*1 end     p_train=p_train'; %6*195     t_train=t_train'; %1*195 for z=1:1:81     p_test=[x2 x2 x2 x2 x2 x2];     t_test=x2; end      p_test=p_test';      t_test=t_test'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %建立 RBF 网络                      goal = 0.0001;                     % 训练误差的平方和 spread = 0.01;                     % 此值越大,需要的神经元就越少 MN = size;              % 最大神经元数 DF = 1;                            % 显示间隔 net = newrb; data_out=sim p_mse=mse figure plot hold on plot title; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %预测并作图 y=sim y_mse=mse figure plot; hold on; plot title; legend;

weixin_39841848

【求助】如何把如下格式用SQL语言部分行以列的形式显示?

【求助】如何把如下格式用SQL语言部分行以列的形式显示?

qdjnlmk

新手求助第二次输入数据怎么让switch函数重新确定-geshui.fig

新手求助第二次输入数据怎么让switch函数重新确定-geshui.fig 各位大神,我是新手,自学matlab,编写了一个计算个税缴纳的计算器GUI,来熟悉matlab的函数。 思路是输入应发工资、公积金抵税额、五险一金,输出交税额、实发工资。 其中,应发工资、公积金抵税额是edit直接输入,五险一金提供了两种方法,第一种是直接输入总额,第二种是输入缴费基数、缴费比例,计算得到。 这两种方式通过radio button二选一来选择,分别为选项一、选项二。设置一个计算button,现在遇到的问题有两个,如下: 1、运行GUI后,输入应发工资、公积金抵税额,五险一金总额,radio默认是五险一金总额计算方法,点击计算button,不能输出结果到edit。须点选项二radio button,再点击选项一radio button,计算才能输出结果。 2、第一次计算后,修改五险一金总额edit数值,点击计算button,输出结果不改变。但是修改公积金抵税额edit数值,点击计算button,可以正常计算。 请教大神,这两个问题如何解决?

weixin_39841856
评论 9
收藏 已收藏
分享
返回顶部
倒在四百页
C语言 70,039 成员 243,237 内容