/*
* you could use QMap to replace std::map, I use std::map because
* QMap do not support std::initializer_list in Qt4.8.2 yet.If QString
* is too expensive for your case, change it back to char
*/
inline std::map<QString, QString> const create_table()
{
return std::map<QString, QString>() = { {"A", "U"}, {"G", "C"}, {"C", "G"}, {"T", "A"} };
}
inline void help2()
{
qDebug() << "please enter a file name";
qtin >> filename;
{
qFatal("can't open the file");
}
qDebug() << "please enter dna";
qtin >> dna;
qDebug() << dna;
auto table = create_table();
int const dna_size = dna.size();
for(int i = 0; i != dna_size; ++i)
{
qDebug
() << table
[QString(dna
[i
])];
}
qDebug() << rna;
qDebug() << endl<< dna_size <<endl;
fileStream << dna << endl << rna << endl;
}
/*
* you could use QMap to replace std::map, I use std::map because
* QMap do not support std::initializer_list in Qt4.8.2 yet.If QString
* is too expensive for your case, change it back to char
*/
inline std::map<QString, QString> const create_table()
{
return std::map<QString, QString>() = { {"A", "U"}, {"G", "C"}, {"C", "G"}, {"T", "A"} };
}
inline void help2()
{
qDebug() << "please enter a file name";
QString filename;
QTextStream qtin(stdin);
qtin >> filename;
QFile file(filename);
if(!file.open(QIODevice::WriteOnly) )
{
qFatal("can't open the file");
}
QString dna;
qDebug() << "please enter dna";
qtin >> dna;
qDebug() << dna;
auto table = create_table();
QString rna;
int const dna_size = dna.size();
for(int i = 0; i != dna_size; ++i)
{
qDebug() << table[QString(dna[i])];
rna += table[QString(dna[i])];
}
qDebug() << rna;
qDebug() << endl<< dna_size <<endl;
QTextStream fileStream(&file);
fileStream << dna << endl << rna << endl;
}
To copy to clipboard, switch view to plain text mode
Bookmarks