SlideShare a Scribd company logo
1 of 1
Download to read offline
Write a function
We want a function, called split, that has three parameters: one input file stream, and two output
file streams. The function split does not open the stream itself. It reads the first number from the
input file, let's call this number f, and uses f to split the input file into one file with all the
numbers that are less or equal to f and one file with all the numbers that are greater than f. The
number less or equal to f and one file with all the numbers that are greater than f. The number
less or equal to f are written into the file connected to the first output file stream parameter and
those greater are written into the file connected to the second output file stream parameter.
Hint; It is possible that the input file is empty.
Solution
#include
using namespace std;
void split(ifstream& in,ofstream& o1,ofstream& o2)
{
int num;
int f;
in>>f; //Take first number
while(in>>num)
{
if(num>f) //if number is less than first number then write to Output 1
{
o1<

More Related Content

Similar to Write a functionWe want a function, called split, that has three p.pdf

File handling in c
File handling in cFile handling in c
File handling in caakanksha s
 
Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Techglyphs
 
Instructions Write a program whose main function is merely a.pdf
Instructions Write a program whose main function is merely a.pdfInstructions Write a program whose main function is merely a.pdf
Instructions Write a program whose main function is merely a.pdfadinathknit
 
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDYC UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDYRajeshkumar Reddy
 
Files in C
Files in CFiles in C
Files in CPrabu U
 
UNIT 10. Files and file handling in C
UNIT 10. Files and file handling in CUNIT 10. Files and file handling in C
UNIT 10. Files and file handling in CAshim Lamichhane
 
file handling, dynamic memory allocation
file handling, dynamic memory allocationfile handling, dynamic memory allocation
file handling, dynamic memory allocationindra Kishor
 
Problem 1- Text Editor using files and strings using C++ In this proje.docx
Problem 1- Text Editor using files and strings using C++ In this proje.docxProblem 1- Text Editor using files and strings using C++ In this proje.docx
Problem 1- Text Editor using files and strings using C++ In this proje.docxrtodd884
 
Hello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfHello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfactioncbe1
 
FILE INPUT OUTPUT.pptx
FILE INPUT OUTPUT.pptxFILE INPUT OUTPUT.pptx
FILE INPUT OUTPUT.pptxssuserd0df33
 
file_handling_in_c.ppt
file_handling_in_c.pptfile_handling_in_c.ppt
file_handling_in_c.pptyuvrajkeshri
 
Amit user defined functions xi (2)
Amit  user defined functions xi (2)Amit  user defined functions xi (2)
Amit user defined functions xi (2)Arpit Meena
 

Similar to Write a functionWe want a function, called split, that has three p.pdf (20)

File handling in c
File handling in cFile handling in c
File handling in c
 
Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Bt0067 c programming and data structures2
Bt0067 c programming and data structures2
 
Instructions Write a program whose main function is merely a.pdf
Instructions Write a program whose main function is merely a.pdfInstructions Write a program whose main function is merely a.pdf
Instructions Write a program whose main function is merely a.pdf
 
Unit V.pptx
Unit V.pptxUnit V.pptx
Unit V.pptx
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 
File_Management_in_C
File_Management_in_CFile_Management_in_C
File_Management_in_C
 
Module 5 file cp
Module 5 file cpModule 5 file cp
Module 5 file cp
 
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDYC UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
 
File management
File managementFile management
File management
 
Unit 5 dwqb ans
Unit 5 dwqb ansUnit 5 dwqb ans
Unit 5 dwqb ans
 
Files in C
Files in CFiles in C
Files in C
 
Unit5 C
Unit5 C Unit5 C
Unit5 C
 
UNIT 10. Files and file handling in C
UNIT 10. Files and file handling in CUNIT 10. Files and file handling in C
UNIT 10. Files and file handling in C
 
file handling, dynamic memory allocation
file handling, dynamic memory allocationfile handling, dynamic memory allocation
file handling, dynamic memory allocation
 
Problem 1- Text Editor using files and strings using C++ In this proje.docx
Problem 1- Text Editor using files and strings using C++ In this proje.docxProblem 1- Text Editor using files and strings using C++ In this proje.docx
Problem 1- Text Editor using files and strings using C++ In this proje.docx
 
Hello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfHello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdf
 
PPS PPT 2.pptx
PPS PPT 2.pptxPPS PPT 2.pptx
PPS PPT 2.pptx
 
FILE INPUT OUTPUT.pptx
FILE INPUT OUTPUT.pptxFILE INPUT OUTPUT.pptx
FILE INPUT OUTPUT.pptx
 
file_handling_in_c.ppt
file_handling_in_c.pptfile_handling_in_c.ppt
file_handling_in_c.ppt
 
Amit user defined functions xi (2)
Amit  user defined functions xi (2)Amit  user defined functions xi (2)
Amit user defined functions xi (2)
 

More from archanenterprises

Lists the stages in the development of the earth and the formatio.pdf
Lists the stages in the development of the earth and the formatio.pdfLists the stages in the development of the earth and the formatio.pdf
Lists the stages in the development of the earth and the formatio.pdfarchanenterprises
 
Martinez Company had 210,000 shares of common stock outstanding on D.pdf
Martinez Company had 210,000 shares of common stock outstanding on D.pdfMartinez Company had 210,000 shares of common stock outstanding on D.pdf
Martinez Company had 210,000 shares of common stock outstanding on D.pdfarchanenterprises
 
Is fat soluble produced in the skin Vitamin K Cortisol Vitamin A V.pdf
Is fat soluble produced in the skin  Vitamin K Cortisol Vitamin A V.pdfIs fat soluble produced in the skin  Vitamin K Cortisol Vitamin A V.pdf
Is fat soluble produced in the skin Vitamin K Cortisol Vitamin A V.pdfarchanenterprises
 
In bacterial chemotaxis, which feature of the bacterial flagella det.pdf
In bacterial chemotaxis, which feature of the bacterial flagella det.pdfIn bacterial chemotaxis, which feature of the bacterial flagella det.pdf
In bacterial chemotaxis, which feature of the bacterial flagella det.pdfarchanenterprises
 
How would I describe the rejection region of the test that has si.pdf
How would I describe the rejection region of the test that has si.pdfHow would I describe the rejection region of the test that has si.pdf
How would I describe the rejection region of the test that has si.pdfarchanenterprises
 
How exactly do Protease inhibitors help HIV patients fight the disea.pdf
How exactly do Protease inhibitors help HIV patients fight the disea.pdfHow exactly do Protease inhibitors help HIV patients fight the disea.pdf
How exactly do Protease inhibitors help HIV patients fight the disea.pdfarchanenterprises
 
Fred, Tom, Jenny and Sarah pooled their money and purchased a packet .pdf
Fred, Tom, Jenny and Sarah pooled their money and purchased a packet .pdfFred, Tom, Jenny and Sarah pooled their money and purchased a packet .pdf
Fred, Tom, Jenny and Sarah pooled their money and purchased a packet .pdfarchanenterprises
 
Explain the various categories of ratio analysis and provide example.pdf
Explain the various categories of ratio analysis and provide example.pdfExplain the various categories of ratio analysis and provide example.pdf
Explain the various categories of ratio analysis and provide example.pdfarchanenterprises
 
Factor the expression completely. Begin by factoring out the lowest .pdf
Factor the expression completely. Begin by factoring out the lowest .pdfFactor the expression completely. Begin by factoring out the lowest .pdf
Factor the expression completely. Begin by factoring out the lowest .pdfarchanenterprises
 
Describe the principal costs incurred in the business that employs y.pdf
Describe the principal costs incurred in the business that employs y.pdfDescribe the principal costs incurred in the business that employs y.pdf
Describe the principal costs incurred in the business that employs y.pdfarchanenterprises
 
Compare and contrast swabs and contact (RODAC) plates for their abil.pdf
Compare and contrast swabs and contact (RODAC) plates for their abil.pdfCompare and contrast swabs and contact (RODAC) plates for their abil.pdf
Compare and contrast swabs and contact (RODAC) plates for their abil.pdfarchanenterprises
 
Briefly explain the ventral and dorsal body cavities and the membran.pdf
Briefly explain the ventral and dorsal body cavities and the membran.pdfBriefly explain the ventral and dorsal body cavities and the membran.pdf
Briefly explain the ventral and dorsal body cavities and the membran.pdfarchanenterprises
 
a connective tissue that is responsible for the shape of our nose..pdf
a connective tissue that is responsible for the shape of our nose..pdfa connective tissue that is responsible for the shape of our nose..pdf
a connective tissue that is responsible for the shape of our nose..pdfarchanenterprises
 
6. In humans, having a widow’s peak (W) is dominant to not having a .pdf
6. In humans, having a widow’s peak (W) is dominant to not having a .pdf6. In humans, having a widow’s peak (W) is dominant to not having a .pdf
6. In humans, having a widow’s peak (W) is dominant to not having a .pdfarchanenterprises
 
28. What is the proposed role of thioredoxin in seed protein mobiliz.pdf
28. What is the proposed role of thioredoxin in seed protein mobiliz.pdf28. What is the proposed role of thioredoxin in seed protein mobiliz.pdf
28. What is the proposed role of thioredoxin in seed protein mobiliz.pdfarchanenterprises
 
Write a short assembly code that does the followingAdd the conten.pdf
Write a short assembly code that does the followingAdd the conten.pdfWrite a short assembly code that does the followingAdd the conten.pdf
Write a short assembly code that does the followingAdd the conten.pdfarchanenterprises
 
Write a 250-300 word abstract explaining that the internet is the gr.pdf
Write a 250-300 word abstract explaining that the internet is the gr.pdfWrite a 250-300 word abstract explaining that the internet is the gr.pdf
Write a 250-300 word abstract explaining that the internet is the gr.pdfarchanenterprises
 
Write a program in java in which you will build the“Sink theShipsGam.pdf
Write a program in java in which you will build the“Sink theShipsGam.pdfWrite a program in java in which you will build the“Sink theShipsGam.pdf
Write a program in java in which you will build the“Sink theShipsGam.pdfarchanenterprises
 
Why is it recommended that vegans take an oral vitamin B12 supplemen.pdf
Why is it recommended that vegans take an oral vitamin B12 supplemen.pdfWhy is it recommended that vegans take an oral vitamin B12 supplemen.pdf
Why is it recommended that vegans take an oral vitamin B12 supplemen.pdfarchanenterprises
 
16. The respirations that accompany metabolic acidosis are frequentl.pdf
16. The respirations that accompany metabolic acidosis are frequentl.pdf16. The respirations that accompany metabolic acidosis are frequentl.pdf
16. The respirations that accompany metabolic acidosis are frequentl.pdfarchanenterprises
 

More from archanenterprises (20)

Lists the stages in the development of the earth and the formatio.pdf
Lists the stages in the development of the earth and the formatio.pdfLists the stages in the development of the earth and the formatio.pdf
Lists the stages in the development of the earth and the formatio.pdf
 
Martinez Company had 210,000 shares of common stock outstanding on D.pdf
Martinez Company had 210,000 shares of common stock outstanding on D.pdfMartinez Company had 210,000 shares of common stock outstanding on D.pdf
Martinez Company had 210,000 shares of common stock outstanding on D.pdf
 
Is fat soluble produced in the skin Vitamin K Cortisol Vitamin A V.pdf
Is fat soluble produced in the skin  Vitamin K Cortisol Vitamin A V.pdfIs fat soluble produced in the skin  Vitamin K Cortisol Vitamin A V.pdf
Is fat soluble produced in the skin Vitamin K Cortisol Vitamin A V.pdf
 
In bacterial chemotaxis, which feature of the bacterial flagella det.pdf
In bacterial chemotaxis, which feature of the bacterial flagella det.pdfIn bacterial chemotaxis, which feature of the bacterial flagella det.pdf
In bacterial chemotaxis, which feature of the bacterial flagella det.pdf
 
How would I describe the rejection region of the test that has si.pdf
How would I describe the rejection region of the test that has si.pdfHow would I describe the rejection region of the test that has si.pdf
How would I describe the rejection region of the test that has si.pdf
 
How exactly do Protease inhibitors help HIV patients fight the disea.pdf
How exactly do Protease inhibitors help HIV patients fight the disea.pdfHow exactly do Protease inhibitors help HIV patients fight the disea.pdf
How exactly do Protease inhibitors help HIV patients fight the disea.pdf
 
Fred, Tom, Jenny and Sarah pooled their money and purchased a packet .pdf
Fred, Tom, Jenny and Sarah pooled their money and purchased a packet .pdfFred, Tom, Jenny and Sarah pooled their money and purchased a packet .pdf
Fred, Tom, Jenny and Sarah pooled their money and purchased a packet .pdf
 
Explain the various categories of ratio analysis and provide example.pdf
Explain the various categories of ratio analysis and provide example.pdfExplain the various categories of ratio analysis and provide example.pdf
Explain the various categories of ratio analysis and provide example.pdf
 
Factor the expression completely. Begin by factoring out the lowest .pdf
Factor the expression completely. Begin by factoring out the lowest .pdfFactor the expression completely. Begin by factoring out the lowest .pdf
Factor the expression completely. Begin by factoring out the lowest .pdf
 
Describe the principal costs incurred in the business that employs y.pdf
Describe the principal costs incurred in the business that employs y.pdfDescribe the principal costs incurred in the business that employs y.pdf
Describe the principal costs incurred in the business that employs y.pdf
 
Compare and contrast swabs and contact (RODAC) plates for their abil.pdf
Compare and contrast swabs and contact (RODAC) plates for their abil.pdfCompare and contrast swabs and contact (RODAC) plates for their abil.pdf
Compare and contrast swabs and contact (RODAC) plates for their abil.pdf
 
Briefly explain the ventral and dorsal body cavities and the membran.pdf
Briefly explain the ventral and dorsal body cavities and the membran.pdfBriefly explain the ventral and dorsal body cavities and the membran.pdf
Briefly explain the ventral and dorsal body cavities and the membran.pdf
 
a connective tissue that is responsible for the shape of our nose..pdf
a connective tissue that is responsible for the shape of our nose..pdfa connective tissue that is responsible for the shape of our nose..pdf
a connective tissue that is responsible for the shape of our nose..pdf
 
6. In humans, having a widow’s peak (W) is dominant to not having a .pdf
6. In humans, having a widow’s peak (W) is dominant to not having a .pdf6. In humans, having a widow’s peak (W) is dominant to not having a .pdf
6. In humans, having a widow’s peak (W) is dominant to not having a .pdf
 
28. What is the proposed role of thioredoxin in seed protein mobiliz.pdf
28. What is the proposed role of thioredoxin in seed protein mobiliz.pdf28. What is the proposed role of thioredoxin in seed protein mobiliz.pdf
28. What is the proposed role of thioredoxin in seed protein mobiliz.pdf
 
Write a short assembly code that does the followingAdd the conten.pdf
Write a short assembly code that does the followingAdd the conten.pdfWrite a short assembly code that does the followingAdd the conten.pdf
Write a short assembly code that does the followingAdd the conten.pdf
 
Write a 250-300 word abstract explaining that the internet is the gr.pdf
Write a 250-300 word abstract explaining that the internet is the gr.pdfWrite a 250-300 word abstract explaining that the internet is the gr.pdf
Write a 250-300 word abstract explaining that the internet is the gr.pdf
 
Write a program in java in which you will build the“Sink theShipsGam.pdf
Write a program in java in which you will build the“Sink theShipsGam.pdfWrite a program in java in which you will build the“Sink theShipsGam.pdf
Write a program in java in which you will build the“Sink theShipsGam.pdf
 
Why is it recommended that vegans take an oral vitamin B12 supplemen.pdf
Why is it recommended that vegans take an oral vitamin B12 supplemen.pdfWhy is it recommended that vegans take an oral vitamin B12 supplemen.pdf
Why is it recommended that vegans take an oral vitamin B12 supplemen.pdf
 
16. The respirations that accompany metabolic acidosis are frequentl.pdf
16. The respirations that accompany metabolic acidosis are frequentl.pdf16. The respirations that accompany metabolic acidosis are frequentl.pdf
16. The respirations that accompany metabolic acidosis are frequentl.pdf
 

Recently uploaded

Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 

Recently uploaded (20)

Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 

Write a functionWe want a function, called split, that has three p.pdf

  • 1. Write a function We want a function, called split, that has three parameters: one input file stream, and two output file streams. The function split does not open the stream itself. It reads the first number from the input file, let's call this number f, and uses f to split the input file into one file with all the numbers that are less or equal to f and one file with all the numbers that are greater than f. The number less or equal to f and one file with all the numbers that are greater than f. The number less or equal to f are written into the file connected to the first output file stream parameter and those greater are written into the file connected to the second output file stream parameter. Hint; It is possible that the input file is empty. Solution #include using namespace std; void split(ifstream& in,ofstream& o1,ofstream& o2) { int num; int f; in>>f; //Take first number while(in>>num) { if(num>f) //if number is less than first number then write to Output 1 { o1<