getline函数是获取一行字符串 不会遇到空格就停止!
特殊乘法
http://www.nowcoder.com/questionTerminal/a5edebf0622045468436c74c3a34240f
getline函数有返回值 可以作为循环输入的判断条件
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;</string></cstdio></iostream>
int main() {
string str, s, x;
int found;
while (getline(cin,str)) {//getline函数是有返回值的
int sum = 0;
found = str.find(' ');
s = str.substr(0, found);
x = str.substr(found + 1, str.size() - found - 1);
for (int i = 0; i < s.size(); i++) {
for (int j = 0; j < x.size(); j++) {
sum = sum + (s[i]-48) * (x[j]-48);//字符数字和真值相差48
}
}
printf("%d",sum);
}
}