Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int f_ampliczb(int tab[],int tab1[20],int n)
- {
- int a=1,b=1,c=0;
- for(int i=1;i<n;i++)
- {
- if(tab[i]>tab[i-1])
- {
- b++;
- if(b>2)
- {
- a=a+(tab[i]-tab[i-1]);
- tab[c]=a;
- }
- }
- else
- {
- c++;
- b=0;
- }
- }
- }
- int main()
- {
- int n,l=0;
- cin>>n;
- int tab[n],tab1[20];
- fstream amp;
- for(int i=0;i<n;i++)
- {
- cin>>tab[i];
- }
- cout<<f_ampliczb(tab, tab1, n);
- amp.open("amp_serii.txt", ios::out);
- while(tab1[l]!=0)
- {
- if(tab1[l]>1)
- amp<<tab1[l]<<"\n";
- l++;
- }
- amp.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement