#include <stdio.h>
#include <string.h>
#include <math.h>
int main(){
char s[100];
int i,counter2;
double counter1;
long long int sum;
while(scanf("%s", s)!=EOF){
counter1 = counter2 = sum = 0;
for(i=0; i<strlen(s); i++){
if(s[i] >= 48 && s[i] <= 57){
counter1 = counter1*10 + (s[i]-'0');
}
else{
if(s[i] == 46 && s[i+2] == 107){
counter1 += double(s[i+1]-'0')/10;
i=i+2;
}
if(s[i] == 46 && s[i+2] == 98){
sum += counter1*8 + (s[i+1]-'0');
i=i+5;
continue;
}
while(s[i] > 97 && s[i] < 122){
counter2 += s[i];
i++;
}
i = i-1;
if(counter2 == 201 || counter2 == 103){
sum += counter1*pow(10,9)*8;
}
else if(counter2 == 207 || counter2 == 109){
sum += counter1*pow(10,6)*8;
}
else if(counter2 == 205 || counter2 == 107){
sum += counter1*pow(10,3)*8;
}
else if(counter2 == 436){
sum += counter1*8;
}
else{
sum += counter1;
}
counter1 = counter2 = 0;
}
}
printf("%lld\n", sum);
}
return 0;
}
counter1 += double(s[i+1]-'0')/10;
這是C還是C++?如果是C的話,double要括號,改成(double)。你現在這是C++才有的寫法