Advertisement
Guest User

sdaasd

a guest
Oct 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int parok;
  8.  
  9. int szamlalo=0;
  10. cin>>parok;
  11. string evo[parok];
  12. string evett[parok];
  13. while(szamlalo<parok)
  14. {
  15. cin>>evo[szamlalo];
  16. cin>>evett[szamlalo];
  17. szamlalo++;
  18. }
  19.  
  20. bool volt=false;
  21. string allatok[parok];
  22. int allatokszama=0;
  23.  
  24. for(int i=0; i<parok; i++)
  25. {
  26.  
  27. for(int j=0; j<i; j++)
  28. {
  29. if(evo[i]== evo[j])
  30. {
  31. volt=true;
  32. }
  33. if (volt)
  34. {
  35. break;
  36. }
  37. }
  38. if(!volt)
  39. {
  40. allatok[i] = evo[i];
  41. allatokszama++;
  42. }
  43. volt=false;
  44. }
  45.  
  46. cout<<allatokszama <<"\n";
  47. for(int i =0; parok; i++)
  48. {
  49. if (allatok[i]!="")
  50. {
  51. cout<< allatok[i] +"\n";
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement