You are to create a program that will read 10 integers from afile and output the
ID: 3614383 • Letter: Y
Question
You are to create a program that will read 10 integers from afile and output the numbers and whether the number is odd or even(zeros may be considered even). Your program should employ acount-controlled while loop to read the values from the file. The while loop should check for two things (what arethey?).
Count and output how many of the numbers were odd and how manywere even
Your program does Not have to output to a file.
----------------------------------------------------------
The input file will be named "Lab6_input.txt" and will have thefollowing data:
Explanation / Answer
please rate - thanks #include #include using namespace std; int main() {int i=0,odd=0,even=0,num; ifstream in; in.open("Lab6_input.txt"); //open file if(in.fail()) //is it ok? { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.