will anybody tell me why this code is not running?
include
include
include
include
using namespace std;
int main()
{
char ch[1000],str[10],*pEnd;
long double d1,d2,d3=0,d4=0,d5;
int i=0;
string dummy;
getline(cin,dummy);
cin.getline(ch,999);
while(ch[i]!='\0')
{
while(ch[i]!='(')
i++;
int j=0;
while(ch[i]!=')')
{
str[j++]=ch[i++];
if(ch[i]==',')
i++;
}
d1=strtod(str,&pEnd);
d2=strtod(pEnd,NULL);
}
while(cin.getline(ch,999))
{
int j=0;
while(ch[i]!='\0')
{
while(ch[i]!='(')
i++;
while(ch[i]!=')')
{
str[j++]=ch[i++];
if(ch[i]==',')
i++;
}
d3=strtod(str,&pEnd);
d4=strtod(pEnd,NULL);
d5=sqrt((d3-d1)*(d3-d1)+(d4-d2)*(d4-d2));
printf("The salesman has traveled a total of %.3llf kilometers.\n",d5);
d1=d3;d2=d4;
}
}
return 0;
}
