SlideShare a Scribd company logo
#include<iostream>
#include<fstream>
#include<cstdlib>
using namespace std;
//This function reads the integers from the file
void readFile(int a[], int arraySize);
//This function calculates the number of odd even and total
numbers
void calculation(int a[], int arraySize);
//This function description the program to user
void descriptionToUser();
//constant declaration
const int arraySize = 10;
int main()
{
//This function is a description the program to user
descriptionToUser();
//variable declaration
string ans;
int intergerArray[arraySize] = { 3,-2,0,1,0,2,0,5,0,2 };
//display to user whether user want to read the array from
file
cout << "nPress "1" to calculate from the array{ 3,-
2,0,1,0,2,0,5,0,2}n"
<< "Press "2" to read the number from filen";
cin >> ans;
if (ans == "1")//if-else loop to get whether the user
chooses to read integers from file
{
cout << "nYou choose to do the calculation from the
array{ 3,-2,0,1,0,2,0,5,0,2}n";
calculation(intergerArray, arraySize);
}
else if (ans == "2")
{
//This function reads the integers from the file
readFile(intergerArray, arraySize);
//This function calculates the number of odd even and
total numbers
calculation(intergerArray, arraySize);
}
else
//Invalid input
cout << "invalid input! Please only press "1" or
"2"n";
}
void descriptionToUser()//This function description the program
to user
{
//display to user what is this program use for
cout << "This program 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,"
<<"and displays the results to screen.n";
}
void readFile(int a[], int arraySize)//this function reads the
integers from the file
{
//variable declaration
ifstream fin;
ofstream fout;
char fileName[16];
//display to user if they choose to read the list from file
cout << "You choose read the list from filen"
<< "Enter your file name";
//input file name
cin >> fileName;
//open the input file
fin.open(fileName);
if (fin.fail())//If-else loop to make sure whether the file
exist
{
cout << "input file opening failedn";
exit(1);
}
for (int i = 0; i < arraySize; i++)//for loop read the array
list from file
{
fin >> a[i];
}
//close the input file
fout.close();
}
void calculation(int a[], int arraySize)//This function calculates
the number of odd even and total numbers
{
//variable declaration
double average, oddAverage, evenAverage;
//initialize variable
double sum = 0;
double evenSum = 0;
double oddSum = 0;
int oddCount = 0;
int evenCount = 0;
int totalCount = 0;
for (int i = 0; i < arraySize; i++)//for loop to
{
//calculate value of sum
sum += a[i];
//total count increment
totalCount++;
if (a[i] % 2 == 0)//if-else loop to make sure wheter
the number is even number
{
//even numbers count increment
evenCount++;
//calculate sum of even numeber
evenSum += a[i];
}
else//if-else loop to make sure wheter the number is
odd number
{
//odd numbers count increment
oddCount++;
//calculate sum of odd numeber
oddSum += a[i];
}
}
////calculate the average of all number
average = sum / totalCount;
//calculate all the odd number average
oddAverage = oddSum / oddCount;
//calculate all the even number average
evenAverage = evenSum / evenCount;
//let the result in currency format
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
//display all result output to the user
cout << "The total sum of the 10 number is: " << sum <<
endl
<< "The total average of the 10 numbers is: " <<
average << endl
<< "The sum of the even numbers is: " << evenSum
<< endl
<< "The average of the even numbers is: " <<
evenAverage << endl
<< "The sum of the odd numbers is: " << oddSum <<
endl
<< "The average of the odd numbers is: " <<
oddAverage << endl;
}
Part Two:
I always think about it and know that I was sophomoric. I was
overconfident and conceited. There was, however, a better side
of me. I was very diligent, organized, and hardworking. I was
mostly reserved…and many people thought of me as intelligent.
The day put to test my abilities in a general, and what I would
call an unfairly fate-filled manner. I…we had longed for the day
to come for the past three months. Here it came. This was going
to be my last class as a sophomore, there is a final semester
examination.
Comparatively, the class activity was simpler for me compared
to the previous ones. All the other six members of Group B,
except me, were already seated in the classroom. They were
patiently waiting for me to arrive because I was their only hope.
As the general rule, the international law lecturer had given
each of the six groups a question to research work on as part of
the continuous assessment test (CAT). We were then to choose
one member to do a class presentation while others provided a
supportive role. Unfortunately for me, I was both the group
leader and the presenter.
Now, most students never take group work that seriously.
Everyone took a component of the question, read, poorly
scribbled something on it, and passed it for me for compilation.
The night before, I had to stay awake the whole night to work
on the final draft to send to the members for approval, awaiting
the presentation at 10.00 am on a fateful day – the 7th day of
May 2017. Since I knew that I still had about 50 minutes before
the start of the presentation, I foolishly went back to sleep, and
that is how my trouble began.
The next thing I heard was my phone ringing at exactly 10.02
am. On the line was Becky.
‘‘Where are you?’’ He desperately enquired.
‘‘I am coming?’’ I half-heartedly responded. I took my bag and
started to run.
As I approached the classroom, I could see Becky, Sammy,
Jorge, and Stephen seated on one side of the corner through the
half-open door. They stared at me with much concern and
desperation at the same time. I could never tell whether they
sympathized with me or them. I never cared anyway. The
classroom was dirty, with papers sticking everywhere on the
wall. I picked my way through the empty spaces and took a seat
near Becky. I could hear scanty laughter in the background. I
did not care either. The humid airs swept through my nostrils
and swarm my lungs and caused my veins to tingle as if they
were being chocked. I did not care.
‘‘Why are you late? You know you are late, and we needed to
discuss a few points’’ Becky inquired again. I thought that her
concerns were inconsequential. I was confident.
‘‘Group B…it is your time, ten minutes,’’ the strong voice
swept through the room.
As I took to the front of the class, I could feel warm rolls of
sweat stream from my face and watered my shirt. My armpits
and pants were already soaked. Stage fright and anxiety can
destroy a student’s performance. Everyone stared at me in awe.
It was the greatest and most memorable day on campus.
2
55 5 90 0 1 11 -8

More Related Content

More from adkinspaige22

-Describe the existing needs for cost information in healthcare firm.docx
-Describe the existing needs for cost information in healthcare firm.docx-Describe the existing needs for cost information in healthcare firm.docx
-Describe the existing needs for cost information in healthcare firm.docxadkinspaige22
 
--------250 words---------Chapter 18 – According to literatu.docx
--------250 words---------Chapter 18 – According to literatu.docx--------250 words---------Chapter 18 – According to literatu.docx
--------250 words---------Chapter 18 – According to literatu.docxadkinspaige22
 
-Please name the functions of the skeletal system.2-Where are lo.docx
-Please name the functions of the skeletal system.2-Where are lo.docx-Please name the functions of the skeletal system.2-Where are lo.docx
-Please name the functions of the skeletal system.2-Where are lo.docxadkinspaige22
 
-TOPIC= Civil Right Movement and Black Power Movement#St.docx
-TOPIC= Civil Right Movement and Black Power Movement#St.docx-TOPIC= Civil Right Movement and Black Power Movement#St.docx
-TOPIC= Civil Right Movement and Black Power Movement#St.docxadkinspaige22
 
- Wordcount 500 to 1000 words- Structure Cover, Table of Conte.docx
- Wordcount 500 to 1000 words- Structure Cover, Table of Conte.docx- Wordcount 500 to 1000 words- Structure Cover, Table of Conte.docx
- Wordcount 500 to 1000 words- Structure Cover, Table of Conte.docxadkinspaige22
 
-What benefits can a diverse workforce provide to an organization.docx
-What benefits can a diverse workforce provide to an organization.docx-What benefits can a diverse workforce provide to an organization.docx
-What benefits can a diverse workforce provide to an organization.docxadkinspaige22
 
-How would you define or describe the American Great Migration m.docx
-How would you define or describe the American Great Migration m.docx-How would you define or describe the American Great Migration m.docx
-How would you define or describe the American Great Migration m.docxadkinspaige22
 
- We learned from our readings that the use of mobile devices in our.docx
- We learned from our readings that the use of mobile devices in our.docx- We learned from our readings that the use of mobile devices in our.docx
- We learned from our readings that the use of mobile devices in our.docxadkinspaige22
 
- Goals (short and long term) and how you developed them; experience.docx
- Goals (short and long term) and how you developed them; experience.docx- Goals (short and long term) and how you developed them; experience.docx
- Goals (short and long term) and how you developed them; experience.docxadkinspaige22
 
- Pick ONE Theme for the 5 short stories (ex setting, character.docx
- Pick ONE Theme for the 5 short stories (ex setting, character.docx- Pick ONE Theme for the 5 short stories (ex setting, character.docx
- Pick ONE Theme for the 5 short stories (ex setting, character.docxadkinspaige22
 
- Briefly summarize the Modernization Theory (discuss all four stage.docx
- Briefly summarize the Modernization Theory (discuss all four stage.docx- Briefly summarize the Modernization Theory (discuss all four stage.docx
- Briefly summarize the Modernization Theory (discuss all four stage.docxadkinspaige22
 
+16159390825Whats app the test online on time .docx
+16159390825Whats app the test online on time .docx+16159390825Whats app the test online on time .docx
+16159390825Whats app the test online on time .docxadkinspaige22
 
(philosophy1. why is mills philosophy closely identified with.docx
(philosophy1. why is mills philosophy closely identified with.docx(philosophy1. why is mills philosophy closely identified with.docx
(philosophy1. why is mills philosophy closely identified with.docxadkinspaige22
 
(only 350 words )In the wake of the terrorist attacks in Septe.docx
(only 350 words )In the wake of the terrorist attacks in Septe.docx(only 350 words )In the wake of the terrorist attacks in Septe.docx
(only 350 words )In the wake of the terrorist attacks in Septe.docxadkinspaige22
 
(I want to write a letter responding to the below statements. I .docx
(I want to write a letter responding to the below statements. I .docx(I want to write a letter responding to the below statements. I .docx
(I want to write a letter responding to the below statements. I .docxadkinspaige22
 
- 1 - Ivey Business Journal JanuaryFebruary 2004Debate a.docx
- 1 - Ivey Business Journal  JanuaryFebruary 2004Debate a.docx- 1 - Ivey Business Journal  JanuaryFebruary 2004Debate a.docx
- 1 - Ivey Business Journal JanuaryFebruary 2004Debate a.docxadkinspaige22
 
+What is the main idea of the story Answer in one paragraph or lo.docx
+What is the main idea of the story Answer in one paragraph or lo.docx+What is the main idea of the story Answer in one paragraph or lo.docx
+What is the main idea of the story Answer in one paragraph or lo.docxadkinspaige22
 
(only 350 words )In the wake of the terrorist attacks in Sep.docx
(only 350 words )In the wake of the terrorist attacks in Sep.docx(only 350 words )In the wake of the terrorist attacks in Sep.docx
(only 350 words )In the wake of the terrorist attacks in Sep.docxadkinspaige22
 
(1) In considering various forms of psychopathology researchers have.docx
(1) In considering various forms of psychopathology researchers have.docx(1) In considering various forms of psychopathology researchers have.docx
(1) In considering various forms of psychopathology researchers have.docxadkinspaige22
 
(1) What do you believe is the most important aspect or criteria.docx
(1) What do you believe is the most important aspect or criteria.docx(1) What do you believe is the most important aspect or criteria.docx
(1) What do you believe is the most important aspect or criteria.docxadkinspaige22
 

More from adkinspaige22 (20)

-Describe the existing needs for cost information in healthcare firm.docx
-Describe the existing needs for cost information in healthcare firm.docx-Describe the existing needs for cost information in healthcare firm.docx
-Describe the existing needs for cost information in healthcare firm.docx
 
--------250 words---------Chapter 18 – According to literatu.docx
--------250 words---------Chapter 18 – According to literatu.docx--------250 words---------Chapter 18 – According to literatu.docx
--------250 words---------Chapter 18 – According to literatu.docx
 
-Please name the functions of the skeletal system.2-Where are lo.docx
-Please name the functions of the skeletal system.2-Where are lo.docx-Please name the functions of the skeletal system.2-Where are lo.docx
-Please name the functions of the skeletal system.2-Where are lo.docx
 
-TOPIC= Civil Right Movement and Black Power Movement#St.docx
-TOPIC= Civil Right Movement and Black Power Movement#St.docx-TOPIC= Civil Right Movement and Black Power Movement#St.docx
-TOPIC= Civil Right Movement and Black Power Movement#St.docx
 
- Wordcount 500 to 1000 words- Structure Cover, Table of Conte.docx
- Wordcount 500 to 1000 words- Structure Cover, Table of Conte.docx- Wordcount 500 to 1000 words- Structure Cover, Table of Conte.docx
- Wordcount 500 to 1000 words- Structure Cover, Table of Conte.docx
 
-What benefits can a diverse workforce provide to an organization.docx
-What benefits can a diverse workforce provide to an organization.docx-What benefits can a diverse workforce provide to an organization.docx
-What benefits can a diverse workforce provide to an organization.docx
 
-How would you define or describe the American Great Migration m.docx
-How would you define or describe the American Great Migration m.docx-How would you define or describe the American Great Migration m.docx
-How would you define or describe the American Great Migration m.docx
 
- We learned from our readings that the use of mobile devices in our.docx
- We learned from our readings that the use of mobile devices in our.docx- We learned from our readings that the use of mobile devices in our.docx
- We learned from our readings that the use of mobile devices in our.docx
 
- Goals (short and long term) and how you developed them; experience.docx
- Goals (short and long term) and how you developed them; experience.docx- Goals (short and long term) and how you developed them; experience.docx
- Goals (short and long term) and how you developed them; experience.docx
 
- Pick ONE Theme for the 5 short stories (ex setting, character.docx
- Pick ONE Theme for the 5 short stories (ex setting, character.docx- Pick ONE Theme for the 5 short stories (ex setting, character.docx
- Pick ONE Theme for the 5 short stories (ex setting, character.docx
 
- Briefly summarize the Modernization Theory (discuss all four stage.docx
- Briefly summarize the Modernization Theory (discuss all four stage.docx- Briefly summarize the Modernization Theory (discuss all four stage.docx
- Briefly summarize the Modernization Theory (discuss all four stage.docx
 
+16159390825Whats app the test online on time .docx
+16159390825Whats app the test online on time .docx+16159390825Whats app the test online on time .docx
+16159390825Whats app the test online on time .docx
 
(philosophy1. why is mills philosophy closely identified with.docx
(philosophy1. why is mills philosophy closely identified with.docx(philosophy1. why is mills philosophy closely identified with.docx
(philosophy1. why is mills philosophy closely identified with.docx
 
(only 350 words )In the wake of the terrorist attacks in Septe.docx
(only 350 words )In the wake of the terrorist attacks in Septe.docx(only 350 words )In the wake of the terrorist attacks in Septe.docx
(only 350 words )In the wake of the terrorist attacks in Septe.docx
 
(I want to write a letter responding to the below statements. I .docx
(I want to write a letter responding to the below statements. I .docx(I want to write a letter responding to the below statements. I .docx
(I want to write a letter responding to the below statements. I .docx
 
- 1 - Ivey Business Journal JanuaryFebruary 2004Debate a.docx
- 1 - Ivey Business Journal  JanuaryFebruary 2004Debate a.docx- 1 - Ivey Business Journal  JanuaryFebruary 2004Debate a.docx
- 1 - Ivey Business Journal JanuaryFebruary 2004Debate a.docx
 
+What is the main idea of the story Answer in one paragraph or lo.docx
+What is the main idea of the story Answer in one paragraph or lo.docx+What is the main idea of the story Answer in one paragraph or lo.docx
+What is the main idea of the story Answer in one paragraph or lo.docx
 
(only 350 words )In the wake of the terrorist attacks in Sep.docx
(only 350 words )In the wake of the terrorist attacks in Sep.docx(only 350 words )In the wake of the terrorist attacks in Sep.docx
(only 350 words )In the wake of the terrorist attacks in Sep.docx
 
(1) In considering various forms of psychopathology researchers have.docx
(1) In considering various forms of psychopathology researchers have.docx(1) In considering various forms of psychopathology researchers have.docx
(1) In considering various forms of psychopathology researchers have.docx
 
(1) What do you believe is the most important aspect or criteria.docx
(1) What do you believe is the most important aspect or criteria.docx(1) What do you believe is the most important aspect or criteria.docx
(1) What do you believe is the most important aspect or criteria.docx
 

Recently uploaded

Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...Denish Jangid
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdfCarlosHernanMontoyab2
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chipsGeoBlogs
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePedroFerreira53928
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPCeline George
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...Nguyen Thanh Tu Collection
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasGeoBlogs
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 

Recently uploaded (20)

NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 

#includeiostream#includefstream#includecstdlib.docx

  • 1. #include<iostream> #include<fstream> #include<cstdlib> using namespace std; //This function reads the integers from the file void readFile(int a[], int arraySize); //This function calculates the number of odd even and total numbers void calculation(int a[], int arraySize); //This function description the program to user void descriptionToUser(); //constant declaration const int arraySize = 10; int main() { //This function is a description the program to user descriptionToUser(); //variable declaration string ans; int intergerArray[arraySize] = { 3,-2,0,1,0,2,0,5,0,2 }; //display to user whether user want to read the array from file cout << "nPress "1" to calculate from the array{ 3,-
  • 2. 2,0,1,0,2,0,5,0,2}n" << "Press "2" to read the number from filen"; cin >> ans; if (ans == "1")//if-else loop to get whether the user chooses to read integers from file { cout << "nYou choose to do the calculation from the array{ 3,-2,0,1,0,2,0,5,0,2}n"; calculation(intergerArray, arraySize); } else if (ans == "2") { //This function reads the integers from the file readFile(intergerArray, arraySize); //This function calculates the number of odd even and total numbers calculation(intergerArray, arraySize); } else //Invalid input cout << "invalid input! Please only press "1" or "2"n"; } void descriptionToUser()//This function description the program to user { //display to user what is this program use for cout << "This program 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,"
  • 3. <<"and displays the results to screen.n"; } void readFile(int a[], int arraySize)//this function reads the integers from the file { //variable declaration ifstream fin; ofstream fout; char fileName[16]; //display to user if they choose to read the list from file cout << "You choose read the list from filen" << "Enter your file name"; //input file name cin >> fileName; //open the input file fin.open(fileName); if (fin.fail())//If-else loop to make sure whether the file exist { cout << "input file opening failedn"; exit(1); } for (int i = 0; i < arraySize; i++)//for loop read the array list from file { fin >> a[i]; } //close the input file fout.close(); }
  • 4. void calculation(int a[], int arraySize)//This function calculates the number of odd even and total numbers { //variable declaration double average, oddAverage, evenAverage; //initialize variable double sum = 0; double evenSum = 0; double oddSum = 0; int oddCount = 0; int evenCount = 0; int totalCount = 0; for (int i = 0; i < arraySize; i++)//for loop to { //calculate value of sum sum += a[i]; //total count increment totalCount++; if (a[i] % 2 == 0)//if-else loop to make sure wheter the number is even number { //even numbers count increment evenCount++; //calculate sum of even numeber evenSum += a[i]; } else//if-else loop to make sure wheter the number is odd number { //odd numbers count increment oddCount++; //calculate sum of odd numeber
  • 5. oddSum += a[i]; } } ////calculate the average of all number average = sum / totalCount; //calculate all the odd number average oddAverage = oddSum / oddCount; //calculate all the even number average evenAverage = evenSum / evenCount; //let the result in currency format cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); //display all result output to the user cout << "The total sum of the 10 number is: " << sum << endl << "The total average of the 10 numbers is: " << average << endl << "The sum of the even numbers is: " << evenSum << endl << "The average of the even numbers is: " << evenAverage << endl << "The sum of the odd numbers is: " << oddSum << endl << "The average of the odd numbers is: " << oddAverage << endl; }
  • 6. Part Two: I always think about it and know that I was sophomoric. I was overconfident and conceited. There was, however, a better side of me. I was very diligent, organized, and hardworking. I was mostly reserved…and many people thought of me as intelligent. The day put to test my abilities in a general, and what I would call an unfairly fate-filled manner. I…we had longed for the day to come for the past three months. Here it came. This was going to be my last class as a sophomore, there is a final semester examination. Comparatively, the class activity was simpler for me compared to the previous ones. All the other six members of Group B, except me, were already seated in the classroom. They were patiently waiting for me to arrive because I was their only hope. As the general rule, the international law lecturer had given each of the six groups a question to research work on as part of the continuous assessment test (CAT). We were then to choose one member to do a class presentation while others provided a supportive role. Unfortunately for me, I was both the group leader and the presenter. Now, most students never take group work that seriously. Everyone took a component of the question, read, poorly scribbled something on it, and passed it for me for compilation. The night before, I had to stay awake the whole night to work on the final draft to send to the members for approval, awaiting the presentation at 10.00 am on a fateful day – the 7th day of May 2017. Since I knew that I still had about 50 minutes before the start of the presentation, I foolishly went back to sleep, and that is how my trouble began. The next thing I heard was my phone ringing at exactly 10.02 am. On the line was Becky. ‘‘Where are you?’’ He desperately enquired. ‘‘I am coming?’’ I half-heartedly responded. I took my bag and started to run. As I approached the classroom, I could see Becky, Sammy,
  • 7. Jorge, and Stephen seated on one side of the corner through the half-open door. They stared at me with much concern and desperation at the same time. I could never tell whether they sympathized with me or them. I never cared anyway. The classroom was dirty, with papers sticking everywhere on the wall. I picked my way through the empty spaces and took a seat near Becky. I could hear scanty laughter in the background. I did not care either. The humid airs swept through my nostrils and swarm my lungs and caused my veins to tingle as if they were being chocked. I did not care. ‘‘Why are you late? You know you are late, and we needed to discuss a few points’’ Becky inquired again. I thought that her concerns were inconsequential. I was confident. ‘‘Group B…it is your time, ten minutes,’’ the strong voice swept through the room. As I took to the front of the class, I could feel warm rolls of sweat stream from my face and watered my shirt. My armpits and pants were already soaked. Stage fright and anxiety can destroy a student’s performance. Everyone stared at me in awe. It was the greatest and most memorable day on campus. 2 55 5 90 0 1 11 -8