Question: //a3.h // Name : #include cmpt_error.h // These are the only #include // files you can #include. #include // Don't remove or change #include //


//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 =====================================================================
// 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
14. (1 mark) Implement a constructor int_vec (fname) that creates a new int_vec by reading int s from the text file fname (where fname is type string). You can assume fname contains valid int s separated by whitespace characters. For example, this prints the numbers in data11.txt: int_vec a("data11.txt"); for(int i = 0; i
Step by Step Solution
3.40 Rating (153 Votes )
There are 3 Steps involved in it
Based on the provided description it seems that you need to implement a constructor intvecfname that ... View full answer
Get step-by-step solutions from verified subject matter experts
