Saturday, May 28, 2011

Inventory Management - Part Two

I've started fiddling around with an inventory management program. I considered trying to figure out how to work with SQLite, but I ended up deciding that it might not be worth it. I'm still iffy about whether or not the benefits are worth taking the time to learn how to do it.

I decided that I could probably just use a vector to store the width of each board in a bundle. I decided to just do a bit of testing by having a file with a bunch of "boards" in it. This file could be read into an array, and then each element of that array could be used. Right?

I just remembered how my vectors always screwed up. I don't remember how I fixed (or even if I fixed) this problem. I've highlighted a few things for you to look at.

Here's my malfunctioning code. Any suggestions? I'm going to look at it more later, but for now, I shall feast upon steaks.

#include <iostream>
#include <fstream>
#include <vector>
using namespace std;


vector <int> bundles(10);


void pieceCount();
float bdft(int, int);
float bdftM(int, int, float);
float bdftD(int, int, float);

int main()
{
    pieceCount();
    for (int i = 0; i < bundles.size(); i++) {
        cout << bundles[i] << "\n";
    }
   
    return 0;
}

// I believe that my problem is somewhere in here. As you can see, I've added a counter that should print
// out whenever it gets a new piece. It just keeps throwing a 1 out at me.
void pieceCount()
{
    ifstream infile ("bundles.rtf");
    if (infile.fail())
        cout << "The file opening is a failure.";
    while (!infile.eof()) {
        int counter = 0;
        int i = 0;
        int pulled;
        infile >> pulled;
        bundles[i] = pulled;
        i++;
        counter++;
        cout << counter;
    }
   
}


float bdft(int height, int length)
{
}

float bdftM(int pieces, int length, float height)
{
}

float bdftD(int pieces, int length, float height)
{
}

No comments:

Post a Comment