Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Create a new file (in Dev C++) and save it as lab11_XYZ.cpp (replace XYZ with your initials).

Create ANOTHER new file (in Dev C++) and save it as swap_XYZ.h (replace XYZ with your initials).

Use the swap_XYZ.h header file to define a set of functions for swapping two items of the same type.

Given the following prototypes, define (overloaded) swap functions

  • void swap(int&, int&);  //swap two integers
  • void swap(double&, double&);  //swap two doubles
  • void swap(float&, float&);  //swap two floats
  • void swap(char&, char&);  //swap two characters
  • void swap(string&, string&);  //swap two strings

The header file should contain the following:

  • header comments (similar to normal program header comments)
  • function definitions (for you to do, based on provided prototypes above...)

In general, a swap works like this:

void swap(type first&, type second&){  type temp = first;  first = second;  second = temp;

}

Once your header file is complete, make sure to include it in your main CPP program. Use double quotes instead of angle brackets. Make sure the header file (H file) is located in the same folder as the CPP file.

#include <iostream>#include "swap_XYZ.h"

using namespace std;

Write a driver program to test your header file. The program should test each version of the swap function and display the results.

The program should:

  • display a hello message consider using displayMessage()!
  • for each version of swap(),
    • provide or prompt for two items consider using prompt()!
    • display which version is being called
    • display values before swap
    • call swap function
    • display values after swap
  • display a goodbye message use displayMessage() again!

Submit the completed H file and the completed CPP file (not the EXE file) back to this assignment

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education