Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main()
- {
- int i = 0, a = 0, c = 0, g = 0, t = 0;
- string s;
- string line,line1;
- int j = 0;
- ifstream myfile("E:\\short.fasta");
- getline(myfile, line1);
- if (myfile.is_open())
- {
- while (!myfile.eof())
- {
- getline(myfile, line);
- s += line;
- }
- myfile.close();
- }
- else cout << "Error!";
- for (int i = 0; i < s.length() - 1; i++)
- {
- if (s[i] == ('A')) { a++; } else
- { if (s[i] == ('a')) { a++; } else
- { if (s[i] == ('C')) { c++; } else
- { if (s[i] == ('c')) { c++; } else
- { if (s[i] == ('G')) { g++; } else
- { if (s[i] == ('g')) { g++; } else
- { if (s[i] == ('T')) { t++; } else
- { if (s[i] == ('t')) { t++; } else
- {
- }
- }
- }
- }
- }
- }
- }
- }
- }
- cout << "A - " << a << endl;
- cout << "C - " << c << endl;
- cout << "G - " << g << endl;
- cout << "T - " << t << endl;
- //f.close();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement