




OUTPUT:
lex.h ----------------- #ifndef LEX_H_ #define LEX_H_ #include <string> #include <iostream> using std::string; using std::istream; using std::ostream;...
#ifndef PROCESSREQUESTRECORD_CLASS #define PROCESSREQUESTRECORD_CLASS #include <iostream> #include <string> using namespace std; class procReqRec { public: // default constructor procReqRec() {} // constructor procReqRec(const string& nm, int p); // access functions int getPriority(); string getName(); // update functions void setPriority(int p); void setName(const string& nm); // for maintenance of a minimum priority queue friend bool operator< (const procReqRec& left, const procReqRec& right); // output a process request record in the format // name: priority friend ostream& operator<< (ostream& ostr, const procReqRec&...
#include <iostream> #include <string> #include "hashT.h" #include "stateData.h" using namespace std; void stateData::setStateInfo(string sName, string sCapital, double stArea, int yAdm, int oAdm) { stateName = sName; stateCapital = sCapital; stArea = stateArea; yAdm = yearOfAdmission; oAdm = orderOfAdmission; } void stateData::getStateInfo(string& sName, string& sCapital, double& stArea, int& yAdm, int& oAdm) { sName = stateName; sCapital = stateCapital; stArea = stateArea; yAdm = yearOfAdmission; oAdm = orderOfAdmission; } string stateData::getStateName() { return stateName;...
I need help with those two functions c++ #ifndef TRIPLE_H #define TRIPLE_H #include <iostream> #include <string> using namespace std; class Triple { private: int a, b, c; public: Triple(); // all elements have value 0 Triple(int k); // all elements have value k Triple(int x, int y, int z); // specifies all three elements Triple(string s); // string representation is "(a,b,c)" string toString(); // create a string representation of the vector void fromString(string s); // change the vector to equal...
// Name.h #ifndef __NAME_H__ #define __NAME_H__ #include <iostream> #include <string> using namespace std; #define MAXLENGTH 12 #define NAME_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-'" namespace Errors { struct InvalidName { }; } class Name { public: Name ( string first_name = "", string last_name = ""); string first() const; string last() const; void set_first( string fname ); void set_last( string lname); friend ostream& operator<< ( ostream & os, Name name ); friend bool operator== (Name name1, Name...
Please show me how to overload the operators << and >> #ifndef LINK_LIST #define LINK_LIST #include <iostream> using namespace std; template <typename T> struct Int_Node { T value; Int_Node<T> *pre, *next; }; template <typename T> class Link_List { template <typename U> friend ostream &operator<<(ostream &, const Link_List<U> &);// print all integers in the list template <typename U> friend istream &operator>>(istream &, Link_List<U> &);// input a value at the back of the list, like insert_node(val);...
If i could get any guidance on how to get this started it will be great. My prof. literally just gave us the information below (which are literally just instructions) and I am unsure on how to get started. For this assignment we are going to create a function that reads an input stream and classifies it into “tokens” from a language that we define here. In this language we make the following rules: ● An identifier is a letter...
/* FILE: ./shapes7/shape.h */
#include <iostream>
using std::ostream;
class shape{
int x,y;
public:
shape( )
{ x=y=0;}
shape(int xvalue, int yvalue);
void setShape(int new_x, int new_y);
void setX(int new_x);
void setY(int new_y);
int getX( ) const;
int getY( ) const;
virtual void move(int x, int y) = 0;
virtual void shift(int dx, int dy) = 0;
virtual void draw( ) = 0;
virtual void rotate(double r) = 0;
virtual void print(ostream&)const;
friend ostream & operator<<(ostream & os, const shape& s);...
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,...
#include <iostream #include <string> #ifndef ACCOUNT H #define ACCOUNT H class Account { public: Account(std::string, int); Account(){}; void deposit(int); void withdraw(int); int getBalance() const; 15 private: int balance{@}; std::string name{}; 18 19 20 Verdif - Account.cpp saved #include "Account.h" Account :: Account(std::string accountName, int startingBalance) : name{accountName) 4 5 if (startingBalance > 0) balance = startingBalance; B 10 void Account::deposit(int depositAmount) { if (depositAmount > 0) balance + depositAmount: ) 12 13 14 15 16 void Account::withdraw(int withdrawAmount) { If...
/ Animal.hpp
#ifndef ANIMAL_H_
#define ANIMAL_H_
#include <string>
class Animal
{
public:
Animal();
Animal(std::string, bool domestic=false, bool
predator=false);
std::string getName() const;
bool isDomestic() const;
bool isPredator() const;
void setName(std::string);
void setDomestic();
void setPredator();
protected: // protected so that derived class can directly
access them
std::string name_;
bool domestic_;
bool predator_;
};
#endif /* ANIMAL_H_ */
//end of Animal.h
//
/////////////////////////////////////////////////////////////////Animal.cpp
#include "Animal.h"
Animal::Animal(): name_(""),domestic_(false),
predator_(false){
}
Animal::Animal(std::string name, bool domestic, bool
predator):
name_(name),domestic_(domestic), predator_(predator)
{
}
std::string Animal::getName() const{
return...