输入n个字符串,把其中以字母A打头的字符串输出。 C++
以下是此题的【c++源代码】
#include <iostream>
#include <string>
using namespace std;
int main()
{ const int n=5;
string str;
for(int i=0;i<n;i++)
{cout<<"please input string:";
cin>>str;
if(str[0]=='A')
cout<<str<<endl;}
return 0;
}
来源:c++程序设计第三版谭浩强课后答案
本文链接:http://www.wb98.com/cjia/post/cjia_5.15_7514.html