Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <fstream>
  4. using namespace std;
  5. int writeFile(int data)
  6. {
  7. ofstream myfile;
  8. myfile.open ("test2.txt");
  9. myfile << data;
  10. myfile.close();
  11. return 0;
  12. }
  13. int main()
  14. {
  15.  
  16.  
  17.  
  18. int a;
  19. int b;
  20. int sum;
  21. cout<<"Podaj pierwszą liczbę:";
  22. cin >> a;
  23. cout<<"Podaj drugą liczbę:";
  24. cin >> b;
  25. sum = a+b;
  26.  
  27. cout << sum;
  28. writeFile(sum);
  29.  
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement