Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CarWarhouse.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include "pch.h"
- #include <string>
- #include <iostream>
- #include "agents.h"
- using namespace std;
- int main()
- {
- string agentName;
- int agentID;
- agents A_1;
- cout << "Administrative login: ";
- cin >> agentName;
- A_1.setAgentName(agentName);
- cout << "Administrative password: ";
- cin >> agentID;
- while (agentID != A_1.getAgentID())
- {
- cout << "Invalid loginn";
- cout << "nAdministrative password: ";
- cin >> agentID;
- }
- cout << endl << "Welcome back, Agent " << endl;
- cout << "Active Agents: " << endl;
- A_1.agentIdentities(); //Function call to agents.cpp
- }
- agents.cpp
- #include "pch.h"
- #include "agents.h"
- #include <string>
- agents::agents() {
- agentName = "";
- agentID = 1111;
- int const size = 4;
- string agentMembers[size] = { "Jacob", "Nathan", "Tomas", "Jack" }; //Agent members string array I want to print to screen.
- }
- agents::agents(string name, int ID)
- {
- agentName = name;
- agentID = ID;
- }
- agents::~agents()
- {}
- string agents::getAgentName() const
- {
- return agentName;
- }
- int agents::getAgentID() const
- {
- return agentID;
- }
- void agents::setAgentName(string incoming)
- {
- agentName = incoming;
- }
- void agents::setAgentIdentity(int ID)
- {
- agentID = ID;
- }
- void agents::agentIdentities() //Main calls this function.
- {
- for (int i = 0; i < size; i++)
- {
- cout << agentMembers[i] << endl;
- }
- cout << agentMembers[0];
- }
- #pragma once
- #include <iostream>
- #include <string>
- using namespace std;
- #ifndef agents_h
- #define agents_h
- class agents{
- public:
- //First thing, default constructor
- agents();
- //Overload Constructor
- agents(string, int);
- //Destructor
- ~agents();
- //Accessor Functions
- //If accessor doesn't modify member variables, end with const on the function name.
- string getAgentName() const;
- //getName returns name of the customer.
- int getAgentID() const;
- void setAgentName(string);
- //getName returns the newly assigned customer reference number.
- void setAgentIdentity(int);
- void agentIdentities();
- //Retrieves agent identites (names within the string array).
- private:
- //Member variables
- string agentName;
- int agentID;
- string agentMembers[4];
- int size = 4;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement