求救!如何用c++罗列一个一维数组 把所有的偶数元素输出

[复制链接]
查看11 | 回复2 | 2008-12-8 07:33:45 | 显示全部楼层 |阅读模式
要求数组元素可以随意输入 并把其中的偶数元素输出

回复

使用道具 举报

千问 | 2008-12-8 07:33:45 | 显示全部楼层
int a[100]={0};for(int i=0;i>a;if(a%2==0){cout#include using namespace std;int main(){ vector intArray; string str; cout<<"输入数字或end结束输入数字:"<<endl; while(...
回复

使用道具 举报

千问 | 2008-12-8 07:33:45 | 显示全部楼层
先提示输入一个最大值,然后分配空间。循环用来检测不同数值,输入0退出。main(){int max,i,*arr;while(1){printf("\nEnter the max numer:");scanf("%d",&max);getchar();if(max==0)break;for(i=2;i<=max;i++){...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行