C++第五次实验
来源:互联网 发布:Linux cookie设置 编辑:程序博客网 时间:2024/06/16 16:26
一、程序及代码
#include<iostream> using namespace std; int main() { const int n=10; int a[n],i,b[n]={0},c[n]={0}; for(i=0;i<n;i++) b[i]=1; for(i=0;i<n;i++) { cin>>a[i]; if(a[i]%2==1) c[i]=a[i]; if(a[i]%2==0) b[i]=a[i]; } cout<<" \n"<<"奇数为:\n"; for(i=0;i<n;i++) { if(c[i]!=0) cout<<c[i]<<" "; } cout<<"偶数为:\n"; cout<<" \n"; for(i=0;i<n;i++) { if(b[i]!=1) cout<<b[i]<<" "; } return 0; }
二、运行结果
成功
三、心得体会
学习到了新东西很开心
四、知识点总结
了解到数组的意义
0 0
- 第五次C语言上机实验报告
- 第五次C程序设计实验报告
- 第五次C语言上机实验报告
- C语言第五次上机实验
- 第五次实验
- 第五次上机实验
- 第五次上机实验
- 第五次上机实验
- 第五次上机实验
- 第五次上机实验
- 第五次上机实验
- 第五次实验报告
- 第五次上机实验
- 第五次上机实验
- 第五次上机实验
- 第五次上机实验
- 第五次上机实验
- 第五次上机实验
- IFIX,VB读写脚本,PDB
- HibernateDaoSupport详解
- SQL中的Update Select
- PhpStorm最新版注册
- HTTP协议的头信息详解
- C++第五次实验
- 重新做软件
- HTML标签笔记
- centos 安装VNCSERVER
- HTML5新增其他元素
- 安装scikits.audiolab
- xcode编译时,有第三方库时,编译设置build active architecture only问题
- Vim 使用大全
- PowerDesigner生成SQL脚本时表名、字段名带引号问题及解决方法