skrt123

Untitled

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