皮皮学,免费搜题
登录
搜题
【简答题】
九、程序设计 共1题 (共计30分) - 题目:主函数main()中由一组正整数组成的一维数组a为测试数据,首先找出出现次数最多的整数,若不同整数有相同的最多出现次数时,选择最早出现的整数。再判断此整数是否为阿姆斯特朗数。 阿姆斯特朗数是指,一个正整数等于其各位数字的立方和。 编写程序: 1 、编写 int maxt(int a[],int n)函数,按上述规则找出数组a中出现次数最多的正整数,函数返回此数。 2 、编写 int amst(int m)函数,判断参数m是否为阿姆斯特朗数,是阿姆斯特朗数函数返回1,否则函数返回0。 #include #include #include #include #include #define N 10 int maxt(int a[],int n) { /**********Program**********/ /********** End **********/ } int amst(int m) { /**********Program**********/ /********** End **********/ } void main() { int a[N]={370,612,153,267,153,153,267,407,407,371}; int m; FILE *fp; if((fp=fopen("data.txt","w"))==NULL) { printf("File open error\n"); exit(0); } m=maxt(a,N); if(amst(m)) { fprintf(fp,"%d is an Armstrong number.\n",m); printf("%d is an Armstrong number.\n",m); } else { fprintf(fp,"%d is not an Armstrong number.\n",m); printf("%d is not an Armstrong number.\n",m); } fclose(fp); }
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【简答题】曝气池出口处的溶解氧宜为 。A. 2mg/L
【简答题】目前标签云制作工具主要采用输入文本、__________、上传文本文件这3种方式来输入内容。
【判断题】检测搭铁端跟点烟器之间的阻值为无穷大,判断搭铁线断路。
A.
正确
B.
错误
【单选题】How did Jefferson interpret the concept of equality?
A.
He asserted that it was a political concepts as well as a biological and economic concept.
B.
He believed that men were born with equal rights.
C.
Equality is a gift of Nature.
D.
Both B and C
【简答题】我国旅游业的客源市场分为()和中国旅游客源市场概括
【简答题】患者第 3 肋间以下感觉发生障碍,提示损伤在于 @font-face { font-family: 宋体;}@font-face { font-family: 黑体;}@font-face { font-family: "Cambria Math";}@font-face { font-family: 仿宋_GB2312;}@font-face { font-family: "@黑体";...
【简答题】旅游客源市场的概念
【单选题】高强韧性冷作模具钢以( )为主。
A.
高速钢
B.
基体钢
C.
中碳合金钢
【单选题】How did Jefferson interpret the concept of equality?
A.
He asserted that it was a political concepts as well as a biological and economic concept.
B.
He believed that men were born with equal rights.
C.
Equality is a gift of Nature.
D.
Both B and
【简答题】心前区疼痛牵涉至左上肢,常见于 @font-face { font-family: 宋体;}@font-face { font-family: 黑体;}@font-face { font-family: "Cambria Math";}@font-face { font-family: 仿宋_GB2312;}@font-face { font-family: "@宋体";}@font-f...
相关题目: