数组
来源:互联网 发布:上淘宝需要哪些手续 编辑:程序博客网 时间:2024/06/10 06:08
//创建一个长度为十六 的数组a并初始化,先输出数组中元素值为3的倍数的数,再输出所有下标为3的倍数的元素值//#include <iostream>#include <iomanip>using namespace std;int main(){ int i; int a[16]={15,21,52,13,4,5,6,7,18,59,45,8,24,5,16,50}; cout<<"数组中元素值为3的倍数的数是:"<<endl; for(i=0;i<=15;i++) { if(a[i]%3==0) cout<<"a["<<i<<"]"<<" "<<a[i]<<endl; } cout<<endl; cout<<"下标为3的倍数的元素是:"<<endl; for(i=0;i<=15;i++) { if(i%3==0) cout<<"a["<<i<<"]"<<" "<<a[i]<<endl; } return 0;}
上一篇发错了,这次是改进!
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- 数组
- Getting Started with ASP.NET MVC 5
- 令数组所有的数据加倍,输出改变后的值
- 大小序详解
- java 调用存储过程实现分页 sql server 2012 版
- 网络栈的层次结构
- 数组
- Android系统Recovery工作原理之使用update.zip升级过程分析(六)---Recovery服务流程细节
- CRIUS_克瑞楒|芮淩商贸有限公司
- 虚拟机中除去虚拟网桥virbr0
- jquery
- 爆GOOGLE实时视频监控
- Windows 8 异步编程
- 网页自适应手机、计算机屏幕的设置方法
- Android系统Recovery工作原理之使用update.zip升级过程分析(七)---Recovery服务的核心install_package函数