Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4. ifstream fin("ciffrecv.in");
  5. ofstream fout("ciffrecv.out");
  6. int v[10];
  7. int main()
  8. {
  9. int x;
  10. while(fin>>x)
  11. {
  12. if(x==7)
  13. {
  14. v[7]++;
  15. }
  16. else
  17. {
  18. if(x==5)
  19. {
  20. v[5]++;
  21. }
  22. else
  23. {
  24. if(x==3)
  25. {
  26. v[3]++;
  27. }
  28. else
  29. {
  30. if(x==2)
  31. {
  32. v[2]++;
  33. }
  34. }
  35. }
  36. }
  37. }
  38. if(v[7]!=0)
  39. {
  40. fout<<7<<" "<<v[7];
  41. }
  42. else
  43. {
  44. if(v[5]!=0)
  45. {
  46. fout<<5<<" "<<v[5];
  47. }
  48. else
  49. {
  50. if(v[3]!=0)
  51. {
  52. fout<<3<<" "<<v[3];
  53. }
  54. else
  55. {
  56. if(v[2]!=0)
  57. {
  58. fout<<2<<" "<<v[2];
  59. }
  60. }
  61. }
  62. }
  63. fin.close();
  64. fout.close();
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement