//a3.h // Name : #include cmpt_error.h // These are the only #include // files you can #include....
Fantastic news! We've Found the answer you've been seeking!
Question:
//a3.h
// Name :
#include "cmpt_error.h" // These are the only
#include // files you can #include.
#include // Don't remove or change
#include // any of them, and don't #include // #include any others.
#include
using namespace std;
class int_vec {
private:
// ...
public:
// ...
}; // class int_vec
// ...
=====================================================================
// a3_test.cpp
// Name :
#include "a3.h"using namespace std;// ... put testing functions here ...int main() { cout << "Assignment 3 Testing ... "; // // ... call testing functions here ... //} // main
=====================================================================
// cmpt_error.h// By defining CMPT_ERROR_H, we avoid problems caused by including this file// more than once: if CMPT_ERROR_H is already defined, then the code is *not*// included.#ifndef CMPT_ERROR_H#define CMPT_ERROR_H#include #include // C++ already has function called error, and so we put our error function// inside a namespace called cmpt. Thus, to use this error function, we will// write its full name, cmpt::error.namespace cmpt {// runtime_error is a pre-defined C++ object meant to be "thrown" when an// error occurs while a program is running. When it is thrown, the program// will end and print the given error message.inline void error(const std::string& message){ throw std::runtime_error(message);}} // namespace cmpt
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: