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 gertrudebellgrove

-Prior to the Civil War, how did the (dominant) discourse over the U.docx
-Prior to the Civil War, how did the (dominant) discourse over the U.docx-Prior to the Civil War, how did the (dominant) discourse over the U.docx
-Prior to the Civil War, how did the (dominant) discourse over the U.docx
gertrudebellgrove
 
- Using the definition Awareness of sensation and perception to ex.docx
- Using the definition Awareness of sensation and perception to ex.docx- Using the definition Awareness of sensation and perception to ex.docx
- Using the definition Awareness of sensation and perception to ex.docx
gertrudebellgrove
 
- should include an introduction to the environmental issue and its .docx
- should include an introduction to the environmental issue and its .docx- should include an introduction to the environmental issue and its .docx
- should include an introduction to the environmental issue and its .docx
gertrudebellgrove
 
- FIRST EXAM SPRING 20201. Describe how the view of operations.docx
- FIRST EXAM SPRING 20201. Describe how the view of operations.docx- FIRST EXAM SPRING 20201. Describe how the view of operations.docx
- FIRST EXAM SPRING 20201. Describe how the view of operations.docx
gertrudebellgrove
 
- Considering the concepts, examples and learning from the v.docx
- Considering the concepts, examples and learning from the v.docx- Considering the concepts, examples and learning from the v.docx
- Considering the concepts, examples and learning from the v.docx
gertrudebellgrove
 
- Discuss why a computer incident response team (CIRT) plan is neede.docx
- Discuss why a computer incident response team (CIRT) plan is neede.docx- Discuss why a computer incident response team (CIRT) plan is neede.docx
- Discuss why a computer incident response team (CIRT) plan is neede.docx
gertrudebellgrove
 
- Discuss why a computer incident response team (CIRT) plan is n.docx
- Discuss why a computer incident response team (CIRT) plan is n.docx- Discuss why a computer incident response team (CIRT) plan is n.docx
- Discuss why a computer incident response team (CIRT) plan is n.docx
gertrudebellgrove
 
- 2 -Section CPlease write your essay in the blue book.docx
- 2 -Section CPlease write your essay in the blue book.docx- 2 -Section CPlease write your essay in the blue book.docx
- 2 -Section CPlease write your essay in the blue book.docx
gertrudebellgrove
 
- Confidence intervals for a population mean, standard deviation kno.docx
- Confidence intervals for a population mean, standard deviation kno.docx- Confidence intervals for a population mean, standard deviation kno.docx
- Confidence intervals for a population mean, standard deviation kno.docx
gertrudebellgrove
 
) Create a new thread. As indicated above, select  two tools describ.docx
) Create a new thread. As indicated above, select  two tools describ.docx) Create a new thread. As indicated above, select  two tools describ.docx
) Create a new thread. As indicated above, select  two tools describ.docx
gertrudebellgrove
 
(Write 3 to 4 sentences per question)  1. Describe one way y.docx
(Write 3 to 4 sentences per question)  1. Describe one way y.docx(Write 3 to 4 sentences per question)  1. Describe one way y.docx
(Write 3 to 4 sentences per question)  1. Describe one way y.docx
gertrudebellgrove
 
( America and Venezuela) this is a ppt. groups assignment. Below is .docx
( America and Venezuela) this is a ppt. groups assignment. Below is .docx( America and Venezuela) this is a ppt. groups assignment. Below is .docx
( America and Venezuela) this is a ppt. groups assignment. Below is .docx
gertrudebellgrove
 
++ 2 PAGES++Topic Make a bill to legalize all felon has the rig.docx
++ 2 PAGES++Topic Make a bill to legalize all felon has the rig.docx++ 2 PAGES++Topic Make a bill to legalize all felon has the rig.docx
++ 2 PAGES++Topic Make a bill to legalize all felon has the rig.docx
gertrudebellgrove
 
(Q1) -Which statement provides the best definition of the Enligh.docx
(Q1) -Which statement provides the best definition of the Enligh.docx(Q1) -Which statement provides the best definition of the Enligh.docx
(Q1) -Which statement provides the best definition of the Enligh.docx
gertrudebellgrove
 
(Student Name)Miami Regional UniversityDate of EncounterP.docx
(Student Name)Miami Regional UniversityDate of EncounterP.docx(Student Name)Miami Regional UniversityDate of EncounterP.docx
(Student Name)Miami Regional UniversityDate of EncounterP.docx
gertrudebellgrove
 
- Considering the concepts, examples and learning from the various m.docx
- Considering the concepts, examples and learning from the various m.docx- Considering the concepts, examples and learning from the various m.docx
- Considering the concepts, examples and learning from the various m.docx
gertrudebellgrove
 
(R1) 245 wordsPublic opinion concerning policy issues.Duri.docx
(R1) 245 wordsPublic opinion concerning policy issues.Duri.docx(R1) 245 wordsPublic opinion concerning policy issues.Duri.docx
(R1) 245 wordsPublic opinion concerning policy issues.Duri.docx
gertrudebellgrove
 
) Now that you have the topic and a good amount of bibliographical s.docx
) Now that you have the topic and a good amount of bibliographical s.docx) Now that you have the topic and a good amount of bibliographical s.docx
) Now that you have the topic and a good amount of bibliographical s.docx
gertrudebellgrove
 
(need in 4 hours 1 to 2 paragraphs)Polygraphs are frequently sho.docx
(need in 4 hours 1 to 2 paragraphs)Polygraphs are frequently sho.docx(need in 4 hours 1 to 2 paragraphs)Polygraphs are frequently sho.docx
(need in 4 hours 1 to 2 paragraphs)Polygraphs are frequently sho.docx
gertrudebellgrove
 
(line 1) When I was bathing, I found a hard spot in my breast. I.docx
(line 1) When I was bathing, I found a hard spot in my breast. I.docx(line 1) When I was bathing, I found a hard spot in my breast. I.docx
(line 1) When I was bathing, I found a hard spot in my breast. I.docx
gertrudebellgrove
 

More from gertrudebellgrove (20)

-Prior to the Civil War, how did the (dominant) discourse over the U.docx
-Prior to the Civil War, how did the (dominant) discourse over the U.docx-Prior to the Civil War, how did the (dominant) discourse over the U.docx
-Prior to the Civil War, how did the (dominant) discourse over the U.docx
 
- Using the definition Awareness of sensation and perception to ex.docx
- Using the definition Awareness of sensation and perception to ex.docx- Using the definition Awareness of sensation and perception to ex.docx
- Using the definition Awareness of sensation and perception to ex.docx
 
- should include an introduction to the environmental issue and its .docx
- should include an introduction to the environmental issue and its .docx- should include an introduction to the environmental issue and its .docx
- should include an introduction to the environmental issue and its .docx
 
- FIRST EXAM SPRING 20201. Describe how the view of operations.docx
- FIRST EXAM SPRING 20201. Describe how the view of operations.docx- FIRST EXAM SPRING 20201. Describe how the view of operations.docx
- FIRST EXAM SPRING 20201. Describe how the view of operations.docx
 
- Considering the concepts, examples and learning from the v.docx
- Considering the concepts, examples and learning from the v.docx- Considering the concepts, examples and learning from the v.docx
- Considering the concepts, examples and learning from the v.docx
 
- Discuss why a computer incident response team (CIRT) plan is neede.docx
- Discuss why a computer incident response team (CIRT) plan is neede.docx- Discuss why a computer incident response team (CIRT) plan is neede.docx
- Discuss why a computer incident response team (CIRT) plan is neede.docx
 
- Discuss why a computer incident response team (CIRT) plan is n.docx
- Discuss why a computer incident response team (CIRT) plan is n.docx- Discuss why a computer incident response team (CIRT) plan is n.docx
- Discuss why a computer incident response team (CIRT) plan is n.docx
 
- 2 -Section CPlease write your essay in the blue book.docx
- 2 -Section CPlease write your essay in the blue book.docx- 2 -Section CPlease write your essay in the blue book.docx
- 2 -Section CPlease write your essay in the blue book.docx
 
- Confidence intervals for a population mean, standard deviation kno.docx
- Confidence intervals for a population mean, standard deviation kno.docx- Confidence intervals for a population mean, standard deviation kno.docx
- Confidence intervals for a population mean, standard deviation kno.docx
 
) Create a new thread. As indicated above, select  two tools describ.docx
) Create a new thread. As indicated above, select  two tools describ.docx) Create a new thread. As indicated above, select  two tools describ.docx
) Create a new thread. As indicated above, select  two tools describ.docx
 
(Write 3 to 4 sentences per question)  1. Describe one way y.docx
(Write 3 to 4 sentences per question)  1. Describe one way y.docx(Write 3 to 4 sentences per question)  1. Describe one way y.docx
(Write 3 to 4 sentences per question)  1. Describe one way y.docx
 
( America and Venezuela) this is a ppt. groups assignment. Below is .docx
( America and Venezuela) this is a ppt. groups assignment. Below is .docx( America and Venezuela) this is a ppt. groups assignment. Below is .docx
( America and Venezuela) this is a ppt. groups assignment. Below is .docx
 
++ 2 PAGES++Topic Make a bill to legalize all felon has the rig.docx
++ 2 PAGES++Topic Make a bill to legalize all felon has the rig.docx++ 2 PAGES++Topic Make a bill to legalize all felon has the rig.docx
++ 2 PAGES++Topic Make a bill to legalize all felon has the rig.docx
 
(Q1) -Which statement provides the best definition of the Enligh.docx
(Q1) -Which statement provides the best definition of the Enligh.docx(Q1) -Which statement provides the best definition of the Enligh.docx
(Q1) -Which statement provides the best definition of the Enligh.docx
 
(Student Name)Miami Regional UniversityDate of EncounterP.docx
(Student Name)Miami Regional UniversityDate of EncounterP.docx(Student Name)Miami Regional UniversityDate of EncounterP.docx
(Student Name)Miami Regional UniversityDate of EncounterP.docx
 
- Considering the concepts, examples and learning from the various m.docx
- Considering the concepts, examples and learning from the various m.docx- Considering the concepts, examples and learning from the various m.docx
- Considering the concepts, examples and learning from the various m.docx
 
(R1) 245 wordsPublic opinion concerning policy issues.Duri.docx
(R1) 245 wordsPublic opinion concerning policy issues.Duri.docx(R1) 245 wordsPublic opinion concerning policy issues.Duri.docx
(R1) 245 wordsPublic opinion concerning policy issues.Duri.docx
 
) Now that you have the topic and a good amount of bibliographical s.docx
) Now that you have the topic and a good amount of bibliographical s.docx) Now that you have the topic and a good amount of bibliographical s.docx
) Now that you have the topic and a good amount of bibliographical s.docx
 
(need in 4 hours 1 to 2 paragraphs)Polygraphs are frequently sho.docx
(need in 4 hours 1 to 2 paragraphs)Polygraphs are frequently sho.docx(need in 4 hours 1 to 2 paragraphs)Polygraphs are frequently sho.docx
(need in 4 hours 1 to 2 paragraphs)Polygraphs are frequently sho.docx
 
(line 1) When I was bathing, I found a hard spot in my breast. I.docx
(line 1) When I was bathing, I found a hard spot in my breast. I.docx(line 1) When I was bathing, I found a hard spot in my breast. I.docx
(line 1) When I was bathing, I found a hard spot in my breast. I.docx
 

Recently uploaded

Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
Nguyen Thanh Tu Collection
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
Observational Learning
Observational Learning Observational Learning
Observational Learning
sanamushtaq922
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
Kalna College
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
Kalna College
 

Recently uploaded (20)

Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
Observational Learning
Observational Learning Observational Learning
Observational Learning
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
 

#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