Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HEADER:
- =======================================================
- #pragma once
- #include "item.h"
- #include <vector>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <fstream>
- class Search
- {
- void Search::inputs(void);
- void Search::feasibility_value(void);
- public:
- Search(void);
- std::ifstream inputfile;
- int weight;
- std::vector<Item> weight_range;
- std::vector<std::vector<Item> > classes;
- std::vector<int> weight_class;
- std::ifstream inputfile;
- int number_of_files;
- char filename[100];
- std::vector<string> filenames;
- std::vector<int> capacities;
- int capacity;
- };
- =================================================
- Code:
- =================================================
- #include <iostream>
- #include <fstream>
- #include <cstdio>
- #include <cstdlib>
- #include "item.h"
- #include "search.h"
- using namespace std;
- Search::Search(void)
- {
- }
- void Search::inputs(void)
- {
- cout << "How many input files need to be run?" << endl;
- cin >> number_of_files;
- for(int i = 0; i < number_of_files; i++)
- {
- cout << "Enter file #" << i + 1 << ": ";
- cin >> filename;
- filenames.push_back(filename);
- }
- cout << "What is the name of the file containing the capacities?" << endl;
- cin >> filename;
- inputfile.open(filename);
- if(inputfile.fail())
- {
- cout << "The capacity file failed to open." << endl;
- system("PAUSE");
- exit(1);
- }
- if(!inputfile.eof())
- {
- while(!inputfile.eof())
- {
- char line[5];
- inputfile.getline(line, 5);
- capacity = atoi(line);
- capacities.push_back(capacity);
- }
- {
- }
- void Search::feasibility_value(void)
- {
- for(int i = start; i < classes.weight_class[j].size(); i++)
- }
Add Comment
Please, Sign In to add comment