类的头文件
#ifndef DNABIGGC_H
#define DNABIGGC_H
#include <string>
#include <iostream>
using std::string;
using std::cout;
using std::endl;
class DNABigGC
{
static int compare(char a,char b);
public:
static int run(string& str,int length);
};
#endif // DNABIGGC_H
类实现
#include "../include/DNABigGC.h"
int DNABigGC::run(string& str,int length)
{
int max=-1;
int s=0;
int e=0;
if(length>=str.size())
return 0;
for(int i=0;i<length;++i)
{
if(str[i]=='G' ||str[i]=='C')
++e;
}
int tag=e;
for(int i=0;i<str.size()-length;++i)
{
switch(DNABigGC::compare(str[i],str[i+length]))
{
case 0:
++s;