Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///_____SUBIECTUL II 5_____
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char s[101], c[101], b[101];
- cin>>s>>c;
- int i, loc=0, j;
- if(strlen(s)!=strlen(c))
- cout<<"cod incorect";
- else
- {
- b[0]=s[0];
- for(i=1; i<strlen(s); i++)
- {
- if(c[i]%2==0)
- {
- loc++;
- for(j=loc; j>=1; j--)
- b[j]=b[j-1];
- b[0]=s[i];
- }
- else
- b[++loc]=s[i];
- }
- b[++loc]='\0';
- }
- cout<<b;
- return 0;
- }
- ///_____SUBIECTUL III 3_____
- int resturi(int n, int x, int y, int r)
- {
- int i, cnt=0;
- for(i=1; i<=n; i++)
- if(i%x==r && i%y==r)
- cnt++;
- return cnt;
- }
- ///_____SUBIECTUL III 4_____
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("bac.txt");
- int main()
- {
- int a, b, c, lmax=-1, lc=0;
- fin>>a>>b;
- while(fin>>c)
- {
- if(a!=b && b!=c && a!=c)
- lc++;
- else
- lc=0;
- if(lc>lmax)
- lmax=lc;
- a=b;
- b=c;
- }
- fout<<lmax+2;
- fin.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment