I just found out I can't use arrays or strings for my homework assignment so I have to redo the entire thing.
I have most of it done, however, I can't figure out how to give a value to two compared characters. Here is a short section of what I'm having trouble with
#include<iostream>
#include<cctype>
#include<cmath>
usingnamespace std;
char transcribe(char);
char nta;
char ntk;
double ntak;
int main() {
cout << "This program is designed to calculate a sequence identity between two different DNA or RNA proteins." << endl;
while (true)
{
cout << "Please start by entering the first nucleotide of the first DNA or RNA sequence." << endl;
cin >> nta;
nta = transcribe(nta);
if (nta != 'A' && nta != 'G' && nta != 'C' && nta != 'U' )
cout << "You did not input a correct nucleotide. Please try again." << endl;
elsebreak;
}
while (true)
{
cout << "Please start by entering the first nucleotide of the second DNA or RNA sequence." << endl;
cin >> ntk;
ntk = transcribe(ntk);
if (ntk != 'A' && ntk != 'G' && ntk != 'C' && ntk != 'U' )
cout << "You did not input a correct nucleotide. Please try again." << endl;
elsebreak;
}
double ntSequence;
if (nta == ntk)
ntak = 1;
else
ntak = 0;
ntSequence = ntak/10;
cout << ntSequence << endl;
return 0;
}
char transcribe(char nt){
if (nt == 't' || nt == 'T')
return'U';
elsereturn toupper (nt);
}
So theoretically, my ntSequence value should be 0.1 or 0 if nta == ntk or nta != ntk, respectively. However, nothing is outputted. I can't figure out the math formula part on why it's not working. The rest works just fine.
Edit: SOLVED: I'm an idiot..I didn't mark my variable as double! Crisis averted! Sorry guys!