Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. string str = ""; int i = 0, a = 0, c = 0, g = 0, t = 0;
  9.  
  10. ifstream f("E:\\short.fasta");
  11. string s;
  12. getline(f, s);
  13.  
  14. for (int i = 0; i < s.length() - 1; i++)
  15. {
  16. if (str[i] == ("A" || "a")) { a++; };
  17. if (str[i] == ("C" || "c")) { c++; };
  18. g = str[i] == ("G" || "g") ? g++ : g;
  19. t = str[i] == ("T" || "t") ? t++ : t;
  20.  
  21. }
  22.  
  23. cout << "A - " << a << endl;
  24. cout << "C - " << c << endl;
  25. cout << "G - " << g << endl;
  26. cout << "T - " << t << endl;
  27. f.close();
  28. system("pause");
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement