⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dna.cpp

📁 简单的模拟DNA配对的程序
💻 CPP
字号:
#include <iostream>#include <fstream>using namespace std;#include "dna.h"static int numChar = 0;					// store count of bytesstatic const int MAX = 3000;			// maximum width of arraystatic char DNAstrand[MAX];				// store strandvoid reverse(ifstream& fin)		// reverse function{	while(!fin.eof())	{		fin.get(DNAstrand[numChar]);		if (fin.good())		{			if (DNAstrand[numChar] != '\n')				numChar++;		}		else			break;	}		// swap bytes		for(int i = 0; i < numChar; i++)	{		if(DNAstrand[i] == 'A')			DNAstrand[i] = 'T';				else if(DNAstrand[i] == 'C')			DNAstrand[i] = 'G';				else if(DNAstrand[i] == 'G')			DNAstrand[i] = 'C';				else if(DNAstrand[i] == 'T')			DNAstrand[i] = 'A';		}			// print	for(int j = numChar-1; j >= 0; j--)		cout << DNAstrand[j];		return;}void save(ofstream& fout)	// save function{	if(fout.good())	{				for(int k = numChar-1; k >= 0; k--)		{			fout.put(DNAstrand[k]);		}			}		fout.close();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -