Page 1 of 1

baby me

Posted: Mon Jun 13, 2016 8:05 am
by mou23
I can;t find any problem with my code.can anyone help me?
#include<iostream>
#include <sstream>
#include<cstdio>

using namespace std;

int main()
{
int t;
scanf("%d",&t);
string s;
getline(cin,s);
for(int i=1;i<=t;i++){
getline(cin,s);
if(s.length()>=4){
istringstream iss(s);
char c1,c2;
double a,b=0;
iss>>a>>c1>>b>>c2;
cout<<"Case "<<i<<": "<<((a*0.5)+(b*0.05))<<endl;
}
else{
istringstream iss(s);
char c1;
double a;
iss>>a>>c1;
cout<<"Case "<<i<<": "<<(a*0.5)<<endl;
}
}
return 0;
}