Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. 2
  2. 8 5
  3. 1 1 1 2 3 4 5 6
  4. 4 7
  5. 1 2 3 4
  6.  
  7. int main()
  8. {
  9. int number;
  10. string filePath;
  11. int numberOfInstances;
  12. int Max;
  13. int Rings;
  14. cout << "please input your file path: " ; //ie, D:\sample.txt
  15.  
  16. cin >> filePath;
  17.  
  18. ifstream fin;
  19.  
  20. fin.open(filePath.c_str());
  21. if(fin.fail()) {
  22. cout << "sorry, fail to open" << endl;
  23. exit(1);
  24. }
  25.  
  26. fin >> numberOfInstances;
  27.  
  28. vector<int> vect1;
  29.  
  30. for(int i = 0; i < numberOfInstances; i++) {
  31. fin >> Rings;
  32. fin >> Max;
  33. for(i = 0; i < Rings; i++) {
  34. fin >> number;
  35. vect1.push_back(number);
  36. }
  37.  
  38. //
  39. //code to process Vect1, eg, sort it
  40. //
  41.  
  42. for(i = 0; i < Rings; i++) {
  43. vect1.pop_back();
  44. }
  45.  
  46. }
  47. fin.close();
  48. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement