Advertisement
Guest User

filelaba2017

a guest
Feb 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <fstream>
  3. #include <iostream>
  4. #include <string>
  5.  
  6. static void func1(const char *s);
  7.  
  8. unsigned int HashLy(const char * str)
  9. {
  10.  
  11. unsigned int hash = 0;
  12.  
  13. for(; *str; str++)
  14. hash = (hash * 1664525) + (unsigned char)(*str) + 1013904223;
  15.  
  16. return hash;
  17.  
  18. }
  19.  
  20. int main() {
  21. std::string filename("lalkalalka.txt");
  22. std::ofstream f_out(filename);
  23. f_out << "aaabbb";
  24. setlocale(LC_ALL,"rus");
  25. std::ifstream f_in(filename);
  26. uint i1(0);\
  27. std::string ssss("");
  28. std::getline(f_in,ssss);
  29. std::cout << ssss << std::endl;
  30. if (!f_in.is_open()){
  31. std::cout << "error" << std::endl;
  32. } else {
  33. for (std::string line; std::getline(f_in, line); )
  34. {
  35. std::cout << line << std::endl;
  36. i1 = HashLy(filename.c_str());
  37. std::cout << i1 << std::endl;
  38. }
  39. }
  40. std::cout << "fsd";
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement