81 987
Assignments Done
98,5%
Successfully Done
In December 2019

# Answer to Question #49974 in C++ for vasanth

Question #49974
To write a program which inputs 25 integers in a 1-d array and copies all even integers in another array and all odd integers in third array.
1
2014-12-16T05:00:41-0500
// The libraries
//To write a program which inputs 25 integers in a 1-d array
//and copies all even integers in another array and all odd integers in third array.
//
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <fstream>
using namespace std;
int main()
{
int arr[25];
const int N=25;int odd=0; int even=0;
for (int i=0;i<25;i++)
{
cout<<"["<<i+1<<"]"<<":";
cin>>arr[i];
if (arr[i]%2==0) even++;
if (arr[i]%2!=0) odd++;
}
cout<<"odd's number = "<<odd<<endl;
cout<<"even's number = "<<even<<endl;
int *oddarr = new int[odd];
int *evenarr = new int[even];
int oddfactor=0;
int evenfactor=0;
for (int i=0;i<25;i++)
{
if (arr[i]%2==0) {oddarr[oddfactor]=arr[i];oddfactor++;}
if (arr[i]%2!=0) {evenarr[evenfactor]=arr[i];evenfactor++;}
}
cout<<"Odd'd array"<<endl;
for(int i=0 ;i<oddfactor;i++){cout<<oddarr[i]<<endl;}
cout<<"Even's array"<<endl;
for(int i=0 ;i<evenfactor;i++){cout<<evenarr[i]<<endl;}
delete [] oddarr;
delete [] evenarr;
return 0;
}
``﻿``

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Assignment Expert
15.12.14, 20:59

Dear salah, please use panel for submitting new questions

salah
14.12.14, 11:34

Write a program that can find the price of all cars in a gallery, the program must specify the total
of each car model and the year it was made for all models in the gallery assuming that there is only 3
cares models and at least 3 deferent years of made for each model.
For example if there is a Honda; and 3 deferent years made 2011, 2012, 2013; find the number of cars
made that year and the total sum price for each year.