Okay, so, working through this tutorial, hoping someone here can give me a better understanding of what code I'm ripping from the tutorial and mashing into my own setup..
First thing I added was...
Type: Posts; User: Shamino
Okay, so, working through this tutorial, hoping someone here can give me a better understanding of what code I'm ripping from the tutorial and mashing into my own setup..
First thing I added was...
So, my simple (not actually simple) goal is to create a junky pong game. I'm not really interested in a third dimension (3d) yet, but I was questioning whether or not to bother with ortho view or...
For my first trick, try to reproduce whatever the heck I was doing right 13 years ago:
Collision testing and response, for all active objects, in one function
...
What is it like 12 years later now and I was able to log in here like it was yesterday?
I'm starting to get old...
Time to start programming again!
This sounds way more fun to do than all of the other suggestions. I can just figure a way to send a stringstream to the ofstream, and create the stringstream from the data members in the employee...
Well, I do not want to use a text file because ultimately I want my code to be a bit more re-usable.
And honestly boost seems to be the best thing for this, as it is minimally intrusive, as I've...
Do I really need to install boost to do serialization, isn't there a standard?
Like this?
class employee
{
public:
employee(std::string, float);
const std::string& get_name();
I've stumbled on this little example: vector::reserve - C++ Reference
What I'm trying to do is stick a bunch of employee objects in a vector, save it to a file, and load the file and use the...
I think I'm getting ahead of myself, I need to simply streamline my functions for managing a vector of employees. I can't worry about making a generic object database that is super ooped up and all...
Ohhh, I see.
Would it be a bad idea to overload an edit function that is in a class called interface?
I would have to relearn how to overload functions D:
could you give me an easy example?
Well here's the thing, I think.
If I take edit out of employee, then some other system needs to have edit.
And if another system needs to have edit, it needs to know how to edit whatever we...
Okay, so right now, menu handles the object itself, but interface needs to remember where it is in the program.
For instance, begin the program with a context menu which allows us to get...
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
using namespace std;
class Menu
{
public:
void display_options()
I want something like this:
interface.generate_menu()
Menu.add_context(object.get_context())
Menu.display_content();
Menu.get_input();
Menu.execute_selection();
Ultimately:...
Maybe I could use a class, which has generic responses, like cancel, exit, or what have you.
And use overloaded operators to add choices, Hmmmm.... The wheels are turning.
Perhaps I would need...
I'm looking for an alternative solution to this mess:
int main()
{
int selection;
string input;
bool goodinput = false;
bool programexit = false;
I've made some adjustments according to the responses to the thread, thanks for your input everyone!
Employee.h:
#ifndef EMPLOYEE_H
#define EMPLOYEE_H
#include <string>
using namespace...
Lol Elysia, I don't know the difference between employee* and *employee, I may have at one point.
I'm not sure if polymorphism would really be applicable in this project, simply because of it's...
Employee is a struct, that I think I will make a class. Elysia, in my vector of employees should i store employee or *employee. Should I let the vector construct manage my memory in the heap?
If...
That's just my way to differentiate between local variables and passed variables, any other suggestions for that?
Also, I'm wondering... I want to put my functions that edit and create employees in a single header. Should I wrap them in a class, what would I call it? What would I call the header?
void edit(employee * _employee)
{
assert (_employee !=NULL);
printf ("%d\n",*_employee);
string input;
int selection;
bool goodinput = false; //loop conditional, input must match...
employee* get_employee(string _name)
{
for (unsigned int i = 0; i < employees.size();)
{
if (_name.compare(employees[i]->name) == 1)
{
return employees[i];
}
else
{