当前位置: 首页 > news >正文

年假作业10

一、选择题

BBDBACCCAD

二、填空题

1,4,13,40

3715

358

5 2 6 1

5 4 8 2 0

2

三、编程题

1、

#include <iostream>
#include<array>
#include <limits>
using namespace std;
int main()
{array<int,10> score;array<int,10>::iterator iter; //定义了一个迭代器for(iter=score.begin();iter!=score.end();iter++)//begin()第一个元素的地址 end()表示最后一个元素的下一个元素的地址{cin >> *iter;//循环输入学生成绩}//使用下标法int index=0;int hscore=score[0];for(int i=1;i<10;++i){if(score[i]>hscore){hscore=score[i];index=i;}}cout << "最高成绩(下标法): " << hscore << ", 学生序号: " << index << endl;//使用地址法int *hscorep=&score[0];for (int *ptr=score.begin();ptr!=score.end();++ptr){if (*ptr>*hscorep){hscorep=ptr;}}int hindex=hscorep-score.begin();cout << "最高成绩(地址法): " << *hscorep << ", 学生序号: " << hindex << endl;return 0;
}

2、

#include <myhead.h>
int main(int argc, const char *argv[])
{int str[5][4];int sum=0,num=0;for(int i=0;i<5;i++){for(int j=0;j<4;j++){scanf("%d",str[i][j]);}}for(int j=0;j<4;j++){for(int i=0;i<5;i++){sum+=str[i][j];}}printf("%d\n",sum);for(int i=0;i<5;i++){num=0;for(int j=0;j<4;j++){num+=str[i][j];}printf("%d\n",num);}for(int i=0;i<5;i++){for(int j=0;j<4;j++){scanf("%d",*(*(str+i)+j));}}for(int j=0;j<4;j++){for(int i=0;i<5;i++){sum+=*(*(str+i)+j);}}printf("%d\n",sum);for(int i=0;i<5;i++){num=0;for(int j=0;j<4;j++){num+=*(*(str+i)+j);}printf("%d\n",num);}return 0;
}

不知道哪里错了

http://www.lryc.cn/news/299320.html

相关文章:

  • [ai笔记4] 将AI工具场景化,应用于生活和工作
  • 【生产实测可用】Redis修改集群弱口令
  • 备战蓝桥杯---图论基础理论
  • [office] excel2003进行可视性加密的方法 #媒体#其他#知识分享
  • 算法沉淀——分治算法(leetcode真题剖析)
  • Qt 进程守护程序
  • Linux_文件系统
  • 算法沉淀——链表(leetcode真题剖析)
  • Flink从入门到实践(一):Flink入门、Flink部署
  • python分离字符串 2022年12月青少年电子学会等级考试 中小学生python编程等级考试二级真题答案解析
  • Excel练习:折线图突出最大最小值
  • 鸿蒙(HarmonyOS)项目方舟框架(ArkUI)之MenuItem组件
  • Mockito测试框架中的方法详解
  • Atcoder ABC339 A - TLD
  • 企业级DevOps实战
  • C++中的new和delete
  • rtt设备io框架面向对象学习-dac设备
  • 腾讯云幻兽帕鲁服务器配置怎么选择合适?
  • 796. 子矩阵的和
  • 如何在 Python 中处理 Unicode
  • CSDN文章导出PDF整理状况一览
  • jmeter-05变量(用户定义变量,用户参数,csv文档参数化)
  • CSS之水平垂直居中
  • 2.8日学习打卡----初学RabbitMQ(三)
  • Unity学习笔记(零基础到就业)|Chapter02:C#基础
  • 容器化的基础概念:不可变基础设施解释:将服务器视为乐高积木,而非橡皮泥。
  • 智胜未来,新时代IT技术人风口攻略-第二版(弃稿)
  • Git分支和迭代流程
  • 数据库管理-第150期 Oracle Vector DB AI-02(20240212)
  • MySQL双写机制