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()
- {
- string str = ""; int i = 0, a = 0, c = 0, g = 0, t = 0;
- ifstream f("E:\\short.fasta");
- string s;
- getline(f, s);
- for (int i = 0; i < s.length() - 1; i++)
- {
- if (str[i] == ("A" || "a")) { a++; };
- if (str[i] == ("C" || "c")) { c++; };
- g = str[i] == ("G" || "g") ? g++ : g;
- t = str[i] == ("T" || "t") ? t++ : t;
- }
- 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