Code


SUBMITTED BY: Guest

DATE: Dec. 25, 2014, 9:20 p.m.

FORMAT: C++

SIZE: 1.9 kB

HITS: 1098

  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <conio.h>
  5. using namespace std;
  6. string intToStr(int n)
  7. {
  8. string tmp;
  9. if(n < 0) {
  10. tmp = "-";
  11. n = -n;
  12. }
  13. if(n > 9)
  14. tmp += intToStr(n / 10);
  15. tmp += n % 10 + 48;
  16. return tmp;
  17. }
  18. int main()
  19. {
  20. fstream file_load_1;
  21. fstream file_load_2;
  22. fstream file_save_1;
  23. fstream file_save_2;
  24. int numer;
  25. cout<<"Podaj numerek: ";
  26. cin>>numer;
  27. file_load_1.open("loadlink.txt",ios::in|ios::out);
  28. file_save_1.open("savelink.txt",ios::in|ios::out|ios::ate);
  29. int num1 = numer;
  30. string data;
  31. if(file_load_1.good()&&file_save_1.good())
  32. {
  33. while(!file_load_1.eof())
  34. {
  35. string str1 = "Wideo[";
  36. str1 += intToStr(num1);
  37. str1 += "]=['";
  38. getline(file_load_1, data);
  39. str1 += data;
  40. str1 += "'];";
  41. file_save_1 << str1 << endl;
  42. num1++;
  43. }
  44. }
  45. else cout<<"lel problem";
  46. num1 = numer;
  47. file_load_2.open("loadtitle.txt",ios::in|ios::out);
  48. file_save_2.open("savetitle.txt",ios::in|ios::out|ios::ate);
  49. if(file_load_2.good()&&file_save_2.good())
  50. {
  51. while(!file_load_2.eof())
  52. {
  53. string str1 = "Wideo1[";
  54. str1 += intToStr(num1);
  55. str1 += "]=['";
  56. getline (file_load_2, data);
  57. str1 += data;
  58. str1 += "'];";
  59. file_save_2 << str1 << endl;
  60. num1++;
  61. }
  62. }
  63. else cout<<"lel problem";
  64. cout<<"koniec"<<endl;
  65. getch();
  66. return 0;
  67. }

comments powered by Disqus