Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- float tab[100][100],dodatnie[100],ujemne[100],zera[100];
- int n,m,a=0,b=0,c=0;
- cout<<"podaj ilosc wierszy: ";
- cin>>n;
- cout<<"podaj ilosc kolumn: ";
- cin>>m;
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<m;j++)
- {
- cout<<"Podaj wartosc o wspolrzednych "<<i<<","<<j<<": ";
- cin>>tab[i][j];
- }
- }
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<m;j++)
- {
- if(tab[i][j]>0)
- {
- dodatnie[a]=tab[i][j];
- a++;
- }
- if(tab[i][j]<0)
- {
- ujemne[b]=tab[i][j];
- b++;
- }
- if(tab[i][j]==0)
- {
- zera[c]=tab[i][j];
- c++;
- }
- }
- }
- cout<<"Dodatnie:"<<endl;
- for(int i=0;i<a;i++)
- {
- cout<<dodatnie[i]<<",";
- }
- cout<<endl<<"Ujemne:"<<endl;
- for(int i=0;i<b;i++)
- {
- cout<<ujemne[i]<<",";
- }
- cout<<endl<<"Zera:"<<endl;
- for(int i=0;i<c;i++)
- {
- cout<<zera[i]<<",";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement