Given a text file containing unknown number of lines, each line containing three integer values representing the height of a building in (Yard foot inches) separated by space. Write a well-documented C++ program that
#include<iostream>
using namespace std;
int main()
{
int N;
cout << "Please, a number of elements: ";
cin >> N;
int* arr = new int[N];
cout << "Enter elements: ";
for (int i = 0; i < N; i++)
{
cin>> arr[i];
}
cout << "\nThe even numbers are ";
for (int i = 0; i < N; i++)
{
if (arr[i] % 2 == 0)
cout << arr[i] << " ";
}
}
Comments
Leave a comment