Guest User

Untitled

a guest
Jul 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. HEADER:
  2. =======================================================
  3.  
  4. #pragma once
  5.  
  6. #include "item.h"
  7. #include <vector>
  8. #include <cstdio>
  9. #include <vector>
  10. #include <iostream>
  11. #include <string>
  12. #include <cstdlib>
  13. #include <fstream>
  14.  
  15. class Search
  16. {
  17. void Search::inputs(void);
  18. void Search::feasibility_value(void);
  19.  
  20. public:
  21. Search(void);
  22. std::ifstream inputfile;
  23. int weight;
  24. std::vector<Item> weight_range;
  25. std::vector<std::vector<Item> > classes;
  26. std::vector<int> weight_class;
  27. std::ifstream inputfile;
  28. int number_of_files;
  29. char filename[100];
  30. std::vector<string> filenames;
  31. std::vector<int> capacities;
  32. int capacity;
  33. };
  34. =================================================
  35. Code:
  36. =================================================
  37. #include <iostream>
  38. #include <fstream>
  39. #include <cstdio>
  40. #include <cstdlib>
  41. #include "item.h"
  42. #include "search.h"
  43.  
  44. using namespace std;
  45.  
  46. Search::Search(void)
  47. {
  48.  
  49.  
  50.  
  51. }
  52.  
  53. void Search::inputs(void)
  54. {
  55. cout << "How many input files need to be run?" << endl;
  56. cin >> number_of_files;
  57.  
  58. for(int i = 0; i < number_of_files; i++)
  59. {
  60. cout << "Enter file #" << i + 1 << ": ";
  61. cin >> filename;
  62. filenames.push_back(filename);
  63. }
  64.  
  65. cout << "What is the name of the file containing the capacities?" << endl;
  66. cin >> filename;
  67.  
  68. inputfile.open(filename);
  69.  
  70. if(inputfile.fail())
  71. {
  72. cout << "The capacity file failed to open." << endl;
  73.  
  74. system("PAUSE");
  75. exit(1);
  76. }
  77.  
  78. if(!inputfile.eof())
  79. {
  80. while(!inputfile.eof())
  81. {
  82. char line[5];
  83. inputfile.getline(line, 5);
  84. capacity = atoi(line);
  85. capacities.push_back(capacity);
  86. }
  87. {
  88. }
  89.  
  90.  
  91. void Search::feasibility_value(void)
  92. {
  93. for(int i = start; i < classes.weight_class[j].size(); i++)
  94.  
  95.  
  96. }
Add Comment
Please, Sign In to add comment