Guest User

Untitled

a guest
Jul 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <iomanip>
  4. #include <fstream>
  5. #include <cstdlib>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. vector<char*>boysNames(1000);
  11. vector<char*>girlsNames(1000);
  12. vector<int>popNum(1000);
  13.  
  14. ifstream babyNamesFile;
  15. babyNamesFile.open("babynames2004.txt");
  16. if (babyNamesFile.fail())
  17. {
  18. cout << "Opening input file failed.\n";
  19. cout << "Make sure you put .txt.\n";
  20. return 0;
  21. }
  22.  
  23. while(!babyNamesFile.eof())
  24. {
  25. for(int i=0; i <= 999; i++)
  26. {
  27. babyNamesFile >> popNum[i] >> boysNames[i] >> girlsNames[i];
  28. }
  29. }
  30. babyNamesFile.close();
  31.  
  32. cout << boysNames[12];
  33. }
Add Comment
Please, Sign In to add comment