C++ programming
John_90
Question
I need this done as soon as possible
This is to help you get started
// DESCRIPTION: Tests IntFunc class #include <iostream> #include <fstream> using namespace std; #include "intFunc.h" void readFile(string filename); int main() { readFile("test1.csv"); readFile("test2.csv"); int domain; int co-domain; // You should test with additional test files, // but comment them out before submission. return 0; } void readFile(string filename){ // read the test file and initialize an IntFunc object. // test all functions. Ex. f.printFx(); }
// FILE: intFunc.h // DESCRIPTION: Definition of the IntFunc class. //#ifndef INTFUNC_H //#define INTFUNC_H #ifndef UNTITLED6_INTFUNC_H #define UNTITLED6_INTFUNC_H #endif //UNTITLED6_INTFUNC_H #include <iostream> #include <string> using namespace std; class IntFunc { private: //Complete the private section of the class int *outputs; // An array that stores outputs int maxX; // The max input value of the domain int maxY; // The max input value of the co-domain // Add additional data members as needed. public: // Constructor: the maximum values in the domain and the codomain // are passed in as arguments. IntFunc(int x, int y); // Adds (x,y) to the function. // Prints a warning if the input already exists. void addPair(int x, int y); // Displays the function to the screen. void printFx() const; // Displays the range of the function. void printRange() const; // Returns true if the function is onto. Returns false otherwise. bool onto() const; // Returns true if the function is one-to-one. Returns false otherwise. bool oneToOne() const; // If the function is a bijection, returns the inverse function, if not print warning IntFunc inverse() const; }; #endif
// FILE: intFunc.cpp // DESCRIPTION: Implementation of the IntFunc class. #include <iostream> using namespace std; #include "intFunc.h" IntFunc::IntFunc(int x, int y) { } intFunc :: IntFunc() // defining the functions { } void IntFunc :: IntFunc(int maxX, int maxY) { } void IntFunc :: addPair(int x, int y) { } void IntFunc :: printFx() { } void IntFunc :: printRange() { } bool IntFunc :: onto() { } bool IntFunc :: oneToOne() { }
4,10 0,5 1,3 2,6 3,7 4,10
5,5 0,5 1,3 2,4 3,0 4,2 5,1
Details
Attachments
Purchase An Answer Below