1、题目类型:字符串。

2、解题思路:水题。

3、注意事项:cin.getline() 中参数的使用。

4、实现方法:

#include<iostream>
#include
<string>
using namespace std;

int main()
{
int i,cnt;
char str[260];
while(cin.getline(str,sizeof(str)) && str[0]!='#')
{
i
=0,cnt=0;
while(str[i]!='\0')
{
if(str[i]!=' ')
cnt
+=(str[i]-'A'+1)*(i+1);
i
++;
}
cout
<<cnt<<endl;
}
return 1;
}

 

相关文章:

  • 2021-06-18
  • 2021-08-28
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-01-05
  • 2021-12-08
猜你喜欢
  • 2021-12-30
  • 2022-01-04
  • 2021-08-16
  • 2021-10-28
  • 2021-08-12
相关资源
相似解决方案