Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. class Image {
  6. int type;
  7. syze_t width, height;
  8. unsigned char *data;
  9.  
  10. public:
  11. void Read (const std::string&);
  12. void Write (const std::string&);
  13. int Type() const;
  14. };
  15.  
  16. void Read(const std::string&) {
  17.  
  18. std::ifstream in("task1.pgm", "rb");
  19. std::string a;
  20. a = in.getline();
  21. if (a == "P2") type = 2;
  22. else if (a == "P3") type = 3;
  23. else if (a == "P5") type = 5;
  24. else if (a == "P6") type = 6;
  25. else throw std::string ("unsupported type");
  26.  
  27. char c
  28.  
  29. }
  30.  
  31. int main () {
  32.  
  33.  
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement