Write a program that reads a list of 10 integers from a file or use a list defin
ID: 3767718 • Letter: W
Question
Write a program that reads a list of 10 integers from a file or use a list defined by the programmer (hard coded). Then the program calculates the total and average for the following numbers: all numbers, odd numbers, and even numbers.
Ask the user if he/she wants to read the numbers from a file. If the user choose not to use a file, then use a array of 10 integers in the body of your code. Ex. a[10] = { 3, -2, 0, ... }
If the user wants to read the values from a file, ask for the file name, and input the content of the file (10 integers) into an array before doing your calculations.
---------------------------------------------------------------------------------------------------------------
Use Arrays for this question
-------------------------------------------------------------------------
This is C++ Beginner Level.
Please Do NOT use Advanced syntax and words
USE the baby steps from Chapters 1 - 6 in Beginner textbook, Problem Solving with C++, Walter Savitch, 8th/9th Edtn
---------------------------------------------------------------------------------------------------
Libaries we have covered in class:
#include <iostream> using namespace std; (do NOT use std::cout)
#include <fstream> Declare an input-file stream variable using ifstream in_stream;
#include <cstdlib> When a stream open function fails,best to stop the program,the function exit halts a program
#include <cmath>
#include <string>
#include <cassert> Can be used to test pre or post conditions
#include <iomanip>
#include <cctype>
--------------------------------------------------------------------------------------------
we have NOT used these libraries, please do NOT use them as well, only use those above.
#include <vector>
#include <iterator>
#include <algorithm>
_____________________________________
need expert answer code in 60 mins.
reply asap thanks
Explanation / Answer
int oddcount=0;