Advertisement
Mikeellee

Untitled

Dec 1st, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8. float tab[100][100],dodatnie[100],ujemne[100],zera[100];
  9. int n,m,a=0,b=0,c=0;
  10.  
  11. cout<<"podaj ilosc wierszy: ";
  12. cin>>n;
  13. cout<<"podaj ilosc kolumn: ";
  14. cin>>m;
  15.  
  16.  
  17. for(int i=0;i<n;i++)
  18. {
  19. for(int j=0;j<m;j++)
  20. {
  21. cout<<"Podaj wartosc o wspolrzednych "<<i<<","<<j<<": ";
  22. cin>>tab[i][j];
  23. }
  24. }
  25. for(int i=0;i<n;i++)
  26. {
  27. for(int j=0;j<m;j++)
  28. {
  29. if(tab[i][j]>0)
  30. {
  31. dodatnie[a]=tab[i][j];
  32. a++;
  33. }
  34. if(tab[i][j]<0)
  35. {
  36. ujemne[b]=tab[i][j];
  37. b++;
  38. }
  39. if(tab[i][j]==0)
  40. {
  41. zera[c]=tab[i][j];
  42. c++;
  43. }
  44. }
  45. }
  46. cout<<"Dodatnie:"<<endl;
  47. for(int i=0;i<a;i++)
  48. {
  49. cout<<dodatnie[i]<<",";
  50. }
  51. cout<<endl<<"Ujemne:"<<endl;
  52. for(int i=0;i<b;i++)
  53. {
  54. cout<<ujemne[i]<<",";
  55. }
  56. cout<<endl<<"Zera:"<<endl;
  57. for(int i=0;i<c;i++)
  58. {
  59. cout<<zera[i]<<",";
  60. }
  61.  
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement