Advertisement
rihardmarius

corte de control basico

Dec 13th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string empleado; int categoria, categoria_ant;
  9.     ifstream input ("empleados.txt");
  10.  
  11.     input >> empleado >> categoria;
  12.     while (not input.eof())
  13.     {
  14.         categoria_ant = categoria;
  15.         cout << categoria_ant << endl;
  16.         while (not input.eof() and categoria_ant == categoria)
  17.         {
  18.             cout << '\t' << empleado << endl;
  19.             input >> empleado >> categoria;
  20.         }
  21.     }
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement