//main.cpp
#ifndef Namespace
#define Namespace
extern int inflag ;
namespace mfc {
extern int inflag;
}
namespace owl {
extern int inflag;
}
void Handle();
#endif

/main.cpp
#ifndef Namespace
#define Namespace
extern int inflag ;
namespace mfc {
extern int inflag;
}
namespace owl {
extern int inflag;
}
void Handle();
void Handle(){
mfc::inflag++;
owl::inflag--;
inflag=inflag%100;
}
#endif
//main.cpp #ifndef Namespace #define Namespace extern int inflag ; namespace mfc { extern int inf...
C++:
questions are in fish.h. Write the code in fish.cpp and
main.cpp
#ifndef FISH_H #define FISH_H #include <vector> class Fish { public: // (1 point) // Write code to initialize edible to is_edible, age to 0, size to 1. Fish (bool is_edible); // (1 point) // Print the vital stats (size and age) of the fish. void Print(); // (1 point) // If fish is at least the age of reproduce_age, reproduce with probability // of reproduce_probability. If reproduce, return...
Add this four functions to the program: push_back, pop_back push_front, pop_front The functions should add or delete from the front or back. The array will need to be resized and copied. Program: main.cpp: #include <iostream> //Input/Output Library using namespace std; //User Libraries #include "SimpleObject.h" //Global Constants, no Global Variables are allowed //Math/Physics/Conversions/Higher Dimensions - i.e. PI, e, etc... //Function Prototypes Simple *fillSmp(int); void prntSmp(Simple *,int); void dstrSmp(Simple *); void push_front(Simple *,int&n,int); //Execution Begins Here! int main(int argc, char** argv) {...
Header file for the Rational class:
#ifndef RATIONAL_H
#define RATIONAL_H
class Rational
{
public:
Rational( int = 0, int = 1 ); // default constructor
Rational addition( const Rational & ) const; // function
addition
Rational subtraction( const Rational & ) const; // function
subtraction
Rational multiplication( const Rational & ) const; // function
multi.
Rational division( const Rational & ) const; // function
division
void printRational () const; // print rational format
void printRationalAsDouble() const; // print rational as...
In C++ ***//Cat.h//*** #ifndef __Cat_h__ #define __Cat_h__ #include <string> using namespace std; struct Cat { double length; double height; double tailLength; string eyeColour; string furClassification; //long, medium, short, none string furColours[5]; }; void initCat (Cat&, double, double, double, string, string, const string[]); void readCat (Cat&); void printCat (const Cat&); bool isCalico (const Cat&); bool isTaller (const Cat&, const Cat&); #endif ***//Cat.cpp//*** #include "Cat.h" #include <iostream> using namespace std; void initCat (Cat& cat, double l, double h, double tL, string eC,...
Header file #ifndef DYNAMIC_ARRAY_INCLUDED #define DYNAMIC_ARRAY_INCLUDED 1 #ifndef __TYPE #define __TYPE # define TYPE int # define TYPE_SIZE sizeof(int) # endif # ifndef LT # define LT(A, B) ((A) < (B)) # endif # ifndef EQ # define EQ(A, B) ((A) == (B)) # endif typedef struct DynArr DynArr; /* Dynamic Array Functions */ void initDynArr(DynArr *v, int capacity); DynArr *newDynArr(int cap); void freeDynArr(DynArr *v); void deleteDynArr(DynArr *v); int sizeDynArr(DynArr *v); void addDynArr(DynArr *v, TYPE val); TYPE getDynArr(DynArr *v, int...
Need to implement Account.cpp and AccountManager.cpp code //Account.hpp #ifndef _ACCOUNT_HPP_ #define _ACCOUNT_HPP_ #include <string> using std::string; class Account { public: Account(); Account(string, double); void deposit(double); bool withdraw(double); string getName() const; double getBalance() const; private: string name; double balance; }; #endif ////////////////////////////////////////////// //AccountManager.hpp #ifndef _ACCOUNT_MANAGER_HPP_ #define _ACCOUNT_MANAGER_HPP_ #include "Account.hpp" #include <string> using std::string; class AccountManager { public: AccountManager(); AccountManager(const AccountManager&); //copy constructor void open(string); void close(string); void depositByName(string,double); bool withdrawByName(string,double); double getBalanceByName(string); Account getAccountByName(string); void openSuperVipAccount(Account&); void closeSuperVipAccount(); bool getBalanceOfSuperVipAccount(double&) const;...
Write a cpp program
Server.h
#ifndef SERVER_H
#define SERVER_H
#include
#include
#include
#include
using namespace std;
class Server
{
public:
Server();
Server(string, int);
~Server();
string getPiece(int);
private:
string *ascii;
mutex access;
};
#endif
--------------------------------------------------------------------------------------------------------------------------
Server.cpp
#include "Server.h"
#include
#include
Server::Server(){}
Server::Server(string filename, int threads)
{
vector loaded;
ascii = new string[threads];
ifstream in;
string line;
in.open(filename);
if (!in.is_open())
{
cout << "Could not open file...
CODES: main.cpp #include <iostream> #include <string> #include "ShoppingCart.h" using namespace std; char PrintMenu() { char answer; cout << "MENU" << endl; cout << "a - Add item to cart" << endl; cout << "d - Remove item from cart" << endl; cout << "c - Change item quantity" << endl; cout << "i - Output items' descriptions" << endl; cout << "o - Output shopping cart" << endl; cout << "q - Quit" << endl << endl; while (true) {...
#include<iostream>
using namespace std;
class TNode
{
public:
int val;
TNode(){}
TNode(int v){val = v;}
TNode * left;
TNode * right;
TNode * parent;
};
class BTree
{
public:
//constructors and destructor
BTree();
BTree(TNode *r);// initialize BTree with the root r. r is the
only node.
BTree(const BTree & t); // copy constructor
BTree(const int *p, const int n);// similar to the copy
constructor, but your input is of the array form.
// input is given an array that denotes...