特殊乘法(字符串循环的结束标志)

#include<iostream>
using namespace std;
int main()
{
char s1[11];
char s2[11];

while (cin >> s1 >> s2)
{
int ans = 0;
for (int i = 0; s1[i] != 0; i++) //字符串判断标志
{
for (int j = 0; s2[j] != 0; j++)
{
ans += (s1[i] - '0')*(s2[j] - '0');
}
}
cout << ans << endl;
}
}

posted @ 2017-09-17 19:44  code666  阅读(203)  评论(0编辑  收藏  举报