baby me

All about problems in Volume 125. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
mou23
New poster
Posts: 1
Joined: Mon Jun 13, 2016 7:11 am

baby me

Post 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;
}
Post Reply

Return to “Volume 125 (12500-12599)”