编写C++程序,该程序可计算输入的DNA序列中的“A”的个数

来源:百度知道 编辑:UC知道 时间:2024/06/04 12:51:10
while((DNAtype=getchar())!='Q'){

显示这个出现错误

是啊

就是输入个字符串数数里面有多少A么?

#include <iostream>
using namespace std;

void main()
{
int count=0;
char DNAtype;
while((DNAtype=getchar())!='Q'){
if(DNAtype=='A')
{
count++;
}
}
cout<<"DNA中A的数目为"<<count<<endl;

}