Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- main()
- {
- ifstream plik("dane_geny.txt");
- string osobnik;
- int gatunki[501];
- string osobniki[1000];
- int maks=0;
- int maksGat=0;
- int lGat=0;
- string geny;
- int ilMut=0;
- for(int i=0; i<501; i++) gatunki[i]=0;
- for(int i=0; i<1000; i++)
- {
- plik>>osobnik;
- gatunki[osobnik.length()]++;
- osobniki[i]=osobnik;
- if(gatunki[osobnik.length()]>maks)
- {
- maks=gatunki[osobnik.length()];
- maksGat=osobnik.length();
- }
- }
- for(int i=0; i<501; i++)
- {
- if(gatunki[i] != 0) lGat += 1;
- }
- //cout << "najliczniejszy gatunek to " << maksGat << " o ilosci osobnikow rownej " << maks << endl << "wszystkich gatunkow jest " << lGat;
- /*for(int i=0; i<1000; i++)
- {
- cout << i+1 << "\t" << osobniki[i] << endl;
- }*/
- for(int i=0; i<1000; i++)
- {
- osobnik = osobniki[i];
- cout << "osobnik: " << i+1 << "\t" << osobnik << endl;
- for(int j=0; j<osobnik.length()-1; j++)
- {
- if(osobnik[j]=='A' && osobnik[j+1]=='A')
- {
- geny="";
- for(int k=j; k<osobnik.length()-1; k++)
- {
- geny+=osobnik[k];
- if(osobnik[k]=='B' && osobnik[k+1]=='C' && osobnik[k+2]=='D' && osobnik[k+3]=='D' && osobnik[k+4]=='C') ilMut+=1;
- if(osobnik[k]=='B' && osobnik[k+1]=='B')
- {
- geny+=osobnik[k+1];
- j=k+2;
- cout << "\""<< geny << "\""<< endl;
- break;
- }
- }
- }
- }
- }
- cout << "ilosc zmutowanych zolwi ninja " << ilMut;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement