#include #ifndef vli_h #define vli_h using namespace std; const int MAXDIGITS = 100; class Integer { public: typedef size_t size_type; // Constructors for VLI Class // Purpose - Default Constructor // Pre Condition - Initialize Private members // Post Condition - Members should have default values Integer(); // Purpose - Constructor Convertor // Pre Condition - Read in from cin // Post Condition - Converts to int from int Integer(int i); // Purpose - Constructor Convertor // Pre Condition - Read in from cin // Post Condition - Converts to int from string Integer(string s); // Purpose - Constructor Convertor // Pre Condition - Makes sure read from file // Post Condition - Converts to int from file Integer(char file_name[]); // Arithmetic Operations // Purpose - To add the two input arrays // Pre Condition - Makes sure the two arrays are int arrays // Post Condition - Adds the two together void addVLI(Integer n2); // Purpose - To subtract the two input arrays // Pre Condition - Makes sure the two arrays are int arrays // Post Condition - Subtracts the second from the first void subVLI(Integer n2); // Predicate Functions // Purpose - To compare the two arrays // Pre Condition - To see if two arrays are equal // Post Condition - Return a true/false answer bool isEqual() const; // Purpose - To compare the two arrays // Pre Condition - To see which vector is greater than the other // Post Condition - Will return the bigger vector bool isGreater() const; // Print Function // Purpose - To print out the current state of the vector // Pre Condition - Must be called to visually compare the state of arrays // Post Condition - Will print out the contents of storage void print() const; private: char a[MAXDIGITS]; int inputSign, i; string s; }; #endif vli_h ----------------------------------------------------------------------------------------- // CPP #include #include #include "vli.h" using namespace std; Integer::Integer() { char a[MAXDIGITS] = {0}; int inputSign, i; string s = ""; } Integer::Integer(int i) {/* No for(size_type x = MAXDIGITS - 1; x >= 0 ; x--) { a[x] = int(b[y]-'0'); y--; }; */ } Integer::Integer(string s) { char b[MAXDIGITS+1]; strcpy_s(b,MAXDIGITS,s.c_str()); int size; size = s.length(); int y = size - 1; for(size_type x = MAXDIGITS - 1; x >= 0 ; x--) { a[x] = int(b[y]-'0'); y--; }; } Integer::Integer(char file_name[]) { } void Integer::print() const { for(size_type x = MAXDIGITS; x > 0; x--) { cout << a[x]; } cout << endl; } void Integer::addVLI(Integer n2) { } void Integer::subVLI(Integer n2) { } /* bool Integer::isEqual() const { } bool Integer::isGreater() const { } */ int main() { Integer I("ABC"); I.print(); return 0; }