nathanaaaa

Untitled

Jan 21st, 2018
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. /**
  2. * @file BlocData.cpp
  3. * @brief Codeages des fonctions bloc data
  4. * @author Samy Letombe, Nathan Pellissiere, Mohammed Senhadji
  5. * @version 1 20/12/17
  6. */
  7.  
  8. #include <iostream>
  9. #include <fstream>
  10. #include <cassert>
  11.  
  12. using namespace std;
  13. #include "BlocData.h"
  14.  
  15. /**
  16. * @brief Lecture d'un bloc de donnée
  17. * @param[in] le flux d'entrée
  18. * @return le BlocData lu
  19. * @pre flux d'entrée valide
  20. */
  21. BlocData lire_bd(istream& is) {
  22.     assert(is);
  23.     BlocData bd;
  24.     is >> bd.noBloc;
  25.     is.seekg(2, ios::cur);
  26.     is.getline(bd.data, max + 1, '\n');
  27.     return bd;
  28. }
  29.  
  30. /**
  31. * @brief Ecriture d'un bloc de donnée
  32. * @param[in] le flux de sortie
  33. * @param[in] la BlocData à écrire
  34. * @pre flux de sortie valide
  35. */
  36. void ecrire_bd(ostream& os, const BlocData& b) {
  37.     assert(os);
  38.     os << b.noBloc << endl;
  39.     os << b.data;
  40. }
  41.  
  42.  
  43. bool enordre(const BlocData& b1, const BlocData& b2) {
  44.     if (b1.noBloc < b2.noBloc)
  45.         return true;
  46.     else return false;
  47.  
  48. }
Add Comment
Please, Sign In to add comment