- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
在线作业指针作函数参数用法(The online job pointer is used as function parameter)
在线作业指针作函数参数用法(The online job pointer is used as function parameter)
9.11 odd or even numbers in an array
Results: 100 / Discount: 0.8
Please make up a function fun (int, *a, int, N, *odd, int, *even, int). The function of the function is to find the sum of all odd numbers in the array, and the sum of all even numbers. The parameter n gives the number of data in the array: returns the sum of the odd numbers by using the pointer odd, and returns the sum of the even numbers by the pointer even.
For example: the values in the array are: 1, 8, 2, 3, 11, 6, and then use the pointer odd to return the odd numbers and 15; use the pointer even to return the even numbers and 16.
Part of the program source code is as follows.
#include stdio.h
#define N 20
Void, fun (int, *a, int, N, int, *odd, int, *even)
{int i;
*odd=*even=0;
For (i=0; in; i++)
If (a[i]%2==0)
*even=*even+a[i];
Else
*odd=*odd+a[i];
}
Int, main ()
{int, a[N], I, N, odd, even;
Scanf (%d, n);
For (i=0; in; i++)
Scanf (%d, a[i]);
Fun (a, N, odd, even);
Printf (The, sum, of, numbers:%d\n, odd, odd);
Printf (The, sum, of, number:%d\n, even, even);
Return 0;
}
Test input, expected output time limit, memory limit, extra process
Test case 1 shows 6 in text mode
1823116?
Display The, sum, of, odd, numbers:15 in text mode?
The, sum, of, even, number:16?
Unlimited 64M 0
9.12 floating points, four, five
Results: 100 / Discount: 0.8
Please make a function float fun (double, a, double, *h). The function of the function is to keep 2 decimal places for the value in the variable H, and to do four to five entries for third bits (the value in the H is positive).
For example, the H value is 8.32433, and the function returns 8.32;
The H value is 8.32533, and the function returns 8.33.
Part of the program source code is as follows.
#include stdio.h
Void fun (double, a, double, *h)
{int, B, c;
B= (int) (a*1000);
C=b%10;
If (c=5) b= (b-c+10) /10;
If (c5) b=b/10;
*h= (float) b/100;
}
Int, main ()
{
Double, a, h;
Scanf (%lf, a);
Fun (a,
您可能关注的文档
- 只问价格不问价值的文学时代(A literary age asking only price and no value).doc
- 叫水法(Water law).doc
- 可 米 路 贝 儿 四 色(Belle four-color comic way).doc
- 可以去记记的歌词(You can remember the lyrics).doc
- 可口可乐 成功(Coca-Cola success).doc
- 口译笔译分类词汇--体育运动词汇(Interpreting, translation, classification, vocabulary -- sports vocabulary).doc
- 可口可乐公司使命与战略目标(Mission and strategic objectives of Coca Cola Co).doc
- 可口可乐引导社会化营销(Coca-Cola leads social marketing).doc
- 可口可乐的面试题目(Coca-Cola interview questions).doc
- 可口麦田 巧克力朝圣之旅 畅享丝滑的幸福滋味(Delicious chocolate in the wheat fields; a pilgrimage trip; a silky happiness).doc
- 2026中国民生银行兰州分行全球校园招聘备考题库及完整答案详解一套.docx
- 2026中国建设银行苏州分行校园招聘230人备考题库附答案详解(名师推荐).docx
- 2026中国建设银行河南省分行校园招聘970人备考题库及一套参考答案详解.docx
- 2026中国建设银行总部校园招聘120人备考题库带答案详解(名师推荐).docx
- 2026中国建设银行建信理财秋季校园招聘9人备考题库(深圳)及答案详解(历年真题).docx
- 2026中国建设银行运营数据中心校园招聘20人备考题库参考答案详解.docx
- 2026中国建设银行建行研修中心华东研修院校园招聘5人备考题库附答案详解(研优卷).docx
- 2026中国建设银行陕西省分行校园招聘590人备考题库含答案详解(典型题).docx
- 2026中国民生银行南京分行全球校园招聘备考题库及答案详解(易错题).docx
- 2026中国民生银行大连分行全球校园招聘备考题库含答案详解(b卷).docx
原创力文档


文档评论(0)