Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream f("BAC.txt");
- int main()
- {
- int n,i,n1=0,n2=0;
- float a[1000],b[1000],v[1000];
- cout<<"n=";cin>>n;
- for (i=0;i<n;i++)
- cin>>v[i];
- for (i=0;i<n;i++)
- {
- if (v[i]>0)
- {
- a[n1]=v[i];
- n1++;
- }
- else if (v[i]<0)
- {
- b[n2]=v[i];
- n2++;
- }
- }
- cout<<"sir poz:"<<endl;
- for (i=0;i<n1;i++)
- cout<<a[i]<<' ';
- cout<<endl;
- cout<<"sir neg:"<<endl;
- for (i=0;i<n2;i++)
- cout<<b[i]<<' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement