
题意: 把T的选项的对应数字输出
思路:遇到一个字符串大小为3,且s【2】为T,那么输出s【0】字母所对应的数字。
#include<iostream>
using namespace std;
int main(){
int n;
string stl;
while(cin>>stl)
if(stl.size()==3&&stl[2]=='T') cout<<stl[0]-'A'+1;
return 0;
}
本文介绍了一段C++代码,该程序通过读取输入的字符串并检查其长度及特定字符来判断是否输出该字符串首字符对应的数字。适用于需要解析特定格式字符串的应用场景。

题意: 把T的选项的对应数字输出
思路:遇到一个字符串大小为3,且s【2】为T,那么输出s【0】字母所对应的数字。
#include<iostream>
using namespace std;
int main(){
int n;
string stl;
while(cin>>stl)
if(stl.size()==3&&stl[2]=='T') cout<<stl[0]-'A'+1;
return 0;
}
2242
1069
531
909
786

被折叠的 条评论
为什么被折叠?