Advertisement
bbg6

Untitled

May 6th, 2019
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. // Brandon Garcia
  2. #include <iostream>
  3. #include <fstream>
  4. #include <iomanip>
  5. #include <stdio.h>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     ifstream Infile("indata.txt");
  12.     int Length[30];
  13.     int item, x;
  14.  
  15.     if(Infile.is_open());
  16.     {
  17.         int item = 0;
  18.         while (!Infile.eof())
  19.         {
  20.             Infile >> Length[item];
  21.             item++;
  22.  
  23.         }
  24.         for (x = 0; x < item - 1; x++)
  25.         {
  26.             cout << Length[x] << endl;
  27.         }
  28.         Infile.close();
  29.     }
  30.     else
  31.     {
  32.         cout << " error " << endl;
  33.     }
  34.     system("pause");
  35.     return 0;
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement