Advertisement
skrt123

Untitled

Dec 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. case 10:
  2. {
  3. system("clear");
  4. cout<<"10. Szétválogatás tétele(páratlan, páros)"<<endl;
  5. cout<<"A tömb adatai: "<<endl;
  6. cout<<"n="<<n<<endl;
  7. cout<<"A tömb elemei: ";
  8. for(int i=0; i<n; i++)
  9. {
  10. cout<<setw(n)<<x[i];
  11. }
  12. cout<<endl;
  13. cout<<endl;
  14. n1=0;
  15. n2=0;
  16. for(int i=0; i<n; i++)
  17. {
  18. if(x[i]%2==1)
  19. {
  20. x1[n1]=x[i];
  21. n1++;
  22. }
  23. else
  24. {
  25. x2[n2]=x[i];
  26. n2++;
  27. }
  28. }
  29. cout<<"Az x1 tömb adatai(páratlan): "<<endl;
  30. cout<<"n1= "<<n1<<endl;
  31. cout<<"Az x1 tömb elemei: ";
  32. for(int i=0; i<n1; i++)
  33. {
  34. cout<<setw(4)<<x1[i];
  35. }
  36. cout<<endl;
  37. cout<<endl;
  38. cout<<"Az x2 tömb adatai(páros): "<<endl;
  39. cout<<"n2= "<<n2<<endl;
  40. cout<<"Az x2 tömb elemei: ";
  41. for(int i=0; i<n2; i++)
  42. {
  43. cout<<setw(4)<<x2[i];
  44. }
  45. cout<<endl;
  46. cin>>get;
  47. break;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement