C++编程,请按题目要求

[复制链接]
查看11 | 回复2 | 2011-5-22 19:29:35 | 显示全部楼层 |阅读模式
26.本题在主函数中给定数组a及其元素个数n,通过调用自定义函数f求给定一维数组中所有下标为奇数的元素之和。请根据函数f 的声明语句及其功能完成函数代码设计。
#include
using namespace std;
#define N 10
int f( int x[ ], int n);
void main()
{int i,a[N];
for (i=0;i>a;
cout>a[j];
cout>a[j];
cout>a[j];
cout>n;
cout>n;
cout#include #include #include using namespace std;#define N 10#define M 3int f_26(int x[],int n){int sum=0;for(int i=0;i<n;i++){if(i%2!=0){sum+=x;}}return sum;}int f_27(int x[][M]){int sum=0;for(int i=0;i<M;i++){for(in
回复

使用道具 举报

千问 | 2011-5-22 19:29:35 | 显示全部楼层
我把你的那些题目都做了。只剩下一个没图片没真相的代码没写。我给你发全部答案过去。上Q收吧。
回复

使用道具 举报

千问 | 2011-5-22 19:29:35 | 显示全部楼层
749029577 先给分吧~时间不多了~到时会给你~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行