SlideShare a Scribd company logo
1 of 1
15 points Write a function that can swap the values of two variables. Use reference semantics so
that the original variables that are passed into the function are swapped. Starter Code: #include
string> #include #include random> int main() { int i = 5 ; int j = 7 ; std: : cout " i = " i " n " ;
std: : cout "j = " j " n " ; I/ TODO: write and call a function capable of swapping the values of ' i
' and ' j ' inplace. Implement the swap within the function itself, the only code you should add to
main is the function call to your new swap function. i.e. swap ( i , j ) ; Sample Output:

More Related Content

More from BorisJX7Mackaym

15- Which of the following factors should be taken into consideration.docx
15- Which of the following factors should be taken into consideration.docx15- Which of the following factors should be taken into consideration.docx
15- Which of the following factors should be taken into consideration.docxBorisJX7Mackaym
 
15- What is a reason for the increasing cost of reaching target audien.docx
15- What is a reason for the increasing cost of reaching target audien.docx15- What is a reason for the increasing cost of reaching target audien.docx
15- What is a reason for the increasing cost of reaching target audien.docxBorisJX7Mackaym
 
14- Copy the formula in cell M7 to the range M8-M15- and edit the copi.docx
14- Copy the formula in cell M7 to the range M8-M15- and edit the copi.docx14- Copy the formula in cell M7 to the range M8-M15- and edit the copi.docx
14- Copy the formula in cell M7 to the range M8-M15- and edit the copi.docxBorisJX7Mackaym
 
14- Although algae are aquatic organisms- one particular order of char.docx
14- Although algae are aquatic organisms- one particular order of char.docx14- Although algae are aquatic organisms- one particular order of char.docx
14- Although algae are aquatic organisms- one particular order of char.docxBorisJX7Mackaym
 
14) What is the number of authorized shares per the charter- 15) What.docx
14) What is the number of authorized shares per the charter- 15) What.docx14) What is the number of authorized shares per the charter- 15) What.docx
14) What is the number of authorized shares per the charter- 15) What.docxBorisJX7Mackaym
 
14) In Guinea pigs black hair (B) is dominant over white ( b)- rough c.docx
14) In Guinea pigs black hair (B) is dominant over white ( b)- rough c.docx14) In Guinea pigs black hair (B) is dominant over white ( b)- rough c.docx
14) In Guinea pigs black hair (B) is dominant over white ( b)- rough c.docxBorisJX7Mackaym
 
13- Many mammals exhibit variations in coat color- For example- weasel.docx
13- Many mammals exhibit variations in coat color- For example- weasel.docx13- Many mammals exhibit variations in coat color- For example- weasel.docx
13- Many mammals exhibit variations in coat color- For example- weasel.docxBorisJX7Mackaym
 
13- Which of the following sorting algorithms could be implemented on.docx
13- Which of the following sorting algorithms could be implemented on.docx13- Which of the following sorting algorithms could be implemented on.docx
13- Which of the following sorting algorithms could be implemented on.docxBorisJX7Mackaym
 
13- Identify three advantages of off-the-shelf soffware versus proprie.docx
13- Identify three advantages of off-the-shelf soffware versus proprie.docx13- Identify three advantages of off-the-shelf soffware versus proprie.docx
13- Identify three advantages of off-the-shelf soffware versus proprie.docxBorisJX7Mackaym
 
14-10 On December 1- the Weber Corporation plans to issue bonds with a.docx
14-10 On December 1- the Weber Corporation plans to issue bonds with a.docx14-10 On December 1- the Weber Corporation plans to issue bonds with a.docx
14-10 On December 1- the Weber Corporation plans to issue bonds with a.docxBorisJX7Mackaym
 
15- Assume that it is possible to co-infect E- coli with two separate.docx
15- Assume that it is possible to co-infect E- coli with two separate.docx15- Assume that it is possible to co-infect E- coli with two separate.docx
15- Assume that it is possible to co-infect E- coli with two separate.docxBorisJX7Mackaym
 
14 1 point Permeability of a weak base drug across plasma membrane inc.docx
14 1 point Permeability of a weak base drug across plasma membrane inc.docx14 1 point Permeability of a weak base drug across plasma membrane inc.docx
14 1 point Permeability of a weak base drug across plasma membrane inc.docxBorisJX7Mackaym
 
12- Seth purchased a variable annuity with a premium deposit of $30-00.docx
12- Seth purchased a variable annuity with a premium deposit of $30-00.docx12- Seth purchased a variable annuity with a premium deposit of $30-00.docx
12- Seth purchased a variable annuity with a premium deposit of $30-00.docxBorisJX7Mackaym
 
14- State four key advantages of the software as a service model- 15.docx
14- State four key advantages of the software as a service model-   15.docx14- State four key advantages of the software as a service model-   15.docx
14- State four key advantages of the software as a service model- 15.docxBorisJX7Mackaym
 
14- Users of government financial statements should be interested in i.docx
14- Users of government financial statements should be interested in i.docx14- Users of government financial statements should be interested in i.docx
14- Users of government financial statements should be interested in i.docxBorisJX7Mackaym
 
14- Taxpayer- age 68- files a 2022 federal income tax return as head o.docx
14- Taxpayer- age 68- files a 2022 federal income tax return as head o.docx14- Taxpayer- age 68- files a 2022 federal income tax return as head o.docx
14- Taxpayer- age 68- files a 2022 federal income tax return as head o.docxBorisJX7Mackaym
 
13- Epstein Barr virus (EBV) infects endothelial cells and B cells- Ab.docx
13- Epstein Barr virus (EBV) infects endothelial cells and B cells- Ab.docx13- Epstein Barr virus (EBV) infects endothelial cells and B cells- Ab.docx
13- Epstein Barr virus (EBV) infects endothelial cells and B cells- Ab.docxBorisJX7Mackaym
 
12- The ability for an advertiser to present large amounts of informat.docx
12- The ability for an advertiser to present large amounts of informat.docx12- The ability for an advertiser to present large amounts of informat.docx
12- The ability for an advertiser to present large amounts of informat.docxBorisJX7Mackaym
 
12- The Consumer Price Index is a simple aggregate index- Answer- 13-.docx
12- The Consumer Price Index is a simple aggregate index- Answer- 13-.docx12- The Consumer Price Index is a simple aggregate index- Answer- 13-.docx
12- The Consumer Price Index is a simple aggregate index- Answer- 13-.docxBorisJX7Mackaym
 

More from BorisJX7Mackaym (20)

15- Which of the following factors should be taken into consideration.docx
15- Which of the following factors should be taken into consideration.docx15- Which of the following factors should be taken into consideration.docx
15- Which of the following factors should be taken into consideration.docx
 
15- What is a reason for the increasing cost of reaching target audien.docx
15- What is a reason for the increasing cost of reaching target audien.docx15- What is a reason for the increasing cost of reaching target audien.docx
15- What is a reason for the increasing cost of reaching target audien.docx
 
14- Copy the formula in cell M7 to the range M8-M15- and edit the copi.docx
14- Copy the formula in cell M7 to the range M8-M15- and edit the copi.docx14- Copy the formula in cell M7 to the range M8-M15- and edit the copi.docx
14- Copy the formula in cell M7 to the range M8-M15- and edit the copi.docx
 
14- Although algae are aquatic organisms- one particular order of char.docx
14- Although algae are aquatic organisms- one particular order of char.docx14- Although algae are aquatic organisms- one particular order of char.docx
14- Although algae are aquatic organisms- one particular order of char.docx
 
14) What is the number of authorized shares per the charter- 15) What.docx
14) What is the number of authorized shares per the charter- 15) What.docx14) What is the number of authorized shares per the charter- 15) What.docx
14) What is the number of authorized shares per the charter- 15) What.docx
 
14) In Guinea pigs black hair (B) is dominant over white ( b)- rough c.docx
14) In Guinea pigs black hair (B) is dominant over white ( b)- rough c.docx14) In Guinea pigs black hair (B) is dominant over white ( b)- rough c.docx
14) In Guinea pigs black hair (B) is dominant over white ( b)- rough c.docx
 
13- Many mammals exhibit variations in coat color- For example- weasel.docx
13- Many mammals exhibit variations in coat color- For example- weasel.docx13- Many mammals exhibit variations in coat color- For example- weasel.docx
13- Many mammals exhibit variations in coat color- For example- weasel.docx
 
13- Which of the following sorting algorithms could be implemented on.docx
13- Which of the following sorting algorithms could be implemented on.docx13- Which of the following sorting algorithms could be implemented on.docx
13- Which of the following sorting algorithms could be implemented on.docx
 
13- Identify three advantages of off-the-shelf soffware versus proprie.docx
13- Identify three advantages of off-the-shelf soffware versus proprie.docx13- Identify three advantages of off-the-shelf soffware versus proprie.docx
13- Identify three advantages of off-the-shelf soffware versus proprie.docx
 
12x2+4xdx.docx
12x2+4xdx.docx12x2+4xdx.docx
12x2+4xdx.docx
 
14-10 On December 1- the Weber Corporation plans to issue bonds with a.docx
14-10 On December 1- the Weber Corporation plans to issue bonds with a.docx14-10 On December 1- the Weber Corporation plans to issue bonds with a.docx
14-10 On December 1- the Weber Corporation plans to issue bonds with a.docx
 
15- Assume that it is possible to co-infect E- coli with two separate.docx
15- Assume that it is possible to co-infect E- coli with two separate.docx15- Assume that it is possible to co-infect E- coli with two separate.docx
15- Assume that it is possible to co-infect E- coli with two separate.docx
 
14 1 point Permeability of a weak base drug across plasma membrane inc.docx
14 1 point Permeability of a weak base drug across plasma membrane inc.docx14 1 point Permeability of a weak base drug across plasma membrane inc.docx
14 1 point Permeability of a weak base drug across plasma membrane inc.docx
 
12- Seth purchased a variable annuity with a premium deposit of $30-00.docx
12- Seth purchased a variable annuity with a premium deposit of $30-00.docx12- Seth purchased a variable annuity with a premium deposit of $30-00.docx
12- Seth purchased a variable annuity with a premium deposit of $30-00.docx
 
14- State four key advantages of the software as a service model- 15.docx
14- State four key advantages of the software as a service model-   15.docx14- State four key advantages of the software as a service model-   15.docx
14- State four key advantages of the software as a service model- 15.docx
 
14- Users of government financial statements should be interested in i.docx
14- Users of government financial statements should be interested in i.docx14- Users of government financial statements should be interested in i.docx
14- Users of government financial statements should be interested in i.docx
 
14- Taxpayer- age 68- files a 2022 federal income tax return as head o.docx
14- Taxpayer- age 68- files a 2022 federal income tax return as head o.docx14- Taxpayer- age 68- files a 2022 federal income tax return as head o.docx
14- Taxpayer- age 68- files a 2022 federal income tax return as head o.docx
 
13- Epstein Barr virus (EBV) infects endothelial cells and B cells- Ab.docx
13- Epstein Barr virus (EBV) infects endothelial cells and B cells- Ab.docx13- Epstein Barr virus (EBV) infects endothelial cells and B cells- Ab.docx
13- Epstein Barr virus (EBV) infects endothelial cells and B cells- Ab.docx
 
12- The ability for an advertiser to present large amounts of informat.docx
12- The ability for an advertiser to present large amounts of informat.docx12- The ability for an advertiser to present large amounts of informat.docx
12- The ability for an advertiser to present large amounts of informat.docx
 
12- The Consumer Price Index is a simple aggregate index- Answer- 13-.docx
12- The Consumer Price Index is a simple aggregate index- Answer- 13-.docx12- The Consumer Price Index is a simple aggregate index- Answer- 13-.docx
12- The Consumer Price Index is a simple aggregate index- Answer- 13-.docx
 

Recently uploaded

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 

Recently uploaded (20)

Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

15 points Write a function that can swap the values of two variables-.docx

  • 1. 15 points Write a function that can swap the values of two variables. Use reference semantics so that the original variables that are passed into the function are swapped. Starter Code: #include string> #include #include random> int main() { int i = 5 ; int j = 7 ; std: : cout " i = " i " n " ; std: : cout "j = " j " n " ; I/ TODO: write and call a function capable of swapping the values of ' i ' and ' j ' inplace. Implement the swap within the function itself, the only code you should add to main is the function call to your new swap function. i.e. swap ( i , j ) ; Sample Output: