if(gene1A[20] == 'T' || gene2A[20] == 'T')
outFile << "Person A is of 'Anemic' type." << endl;
else if(gene1A[20] == 'T' && gene2A[20] == 'T')
outFile << "Person A if of 'Carrier' type." << endl;
else
outFile << "Person A is of 'Normal' type." << endl;
if(gene1B[20] == 'T' || gene2B[20] == 'T')
outFile << "Person B is of 'Anemic' type." << endl;
else if(gene1B[20] == 'T' && gene2B[20] == 'T')
outFile << "Person B if of 'Carrier' type." << endl;
else
outFile << "Person B is of 'Normal' type." << endl;
if(gene1C[20] == 'T' || gene2C[20] == 'T')
outFile << "Person C is of 'Anemic' type." << endl;
else if(gene1C[20] == 'T' && gene2C[20] == 'T')
outFile << "Person C if of 'Carrier' type." << endl;
else
outFile << "Person C is of 'Normal' type." << endl;
if(gene1D[20] == 'T' || gene2D[20] == 'T')
outFile << "Person D is of 'Anemic' type." << endl;
else if(gene1A[20] == 'T' && gene2A[20] == 'T')
outFile << "Person D if of 'Carrier' type." << endl;
else
outFile << "Person D is of 'Normal' type." << endl;
是我现在的代码。我需要做的是根据我设置的数组输出“outFile”,如果这个人是贫血、携带者或正常人。每个数组有 444 个字符长,可以是 A、C、T 或 O。如果 T 位于gene1[] 和/或gene2[] 的第 20 位,则此人将贫血(如果只有一个数组)或一个载体(如果在两个数组中)。
我现在拥有的东西使它们自动成为“正常”。我相信我的 if 语句设置不正确,但我需要的是引用数组中的第 20 个值,然后如果它 == 'T',则输出它们的“类型”。
注意:我注意到在我的代码中我输入了 20 而不是 19。我进行了更正,所以请看过去。
多谢你们!