ChameL1oN

АиП_Лаба4

Apr 11th, 2015
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <locale>
  4. #include <set>
  5.  
  6. using namespace std;
  7.  
  8. ifstream f("input.txt", ios::in);
  9. ofstream F("output.txt");
  10.  
  11.  
  12. void main(){
  13. set<int> cifr;
  14. set<int>::iterator it;
  15. int n,a,b;
  16. f >> n;
  17. for (int i = 0; i < n; i++){
  18. f >> a;
  19. while (a > 0){
  20. b = a % 10;
  21. cifr.insert(b);
  22. a /= 10;
  23. }
  24. }
  25. for (it = cifr.begin(); it != cifr.end(); ++it){
  26. F << *it << " ";
  27. }
  28. F << endl;
  29. cout << endl;
  30. for (int i = 0; i < 10; i++){
  31. if (cifr.find(i) == cifr.end()){
  32. F << i << " ";
  33. }
  34. }
  35. cout << endl;
  36. F.close();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment