如何修改以下程序,使$后的数字转换成 浮点数赋值到程序的双精度变量中,用printf显示出来

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
char ori_str[] = "You will pay $687.71 every month for 15 years to payoff the debt";
char *str1 = NULL;
char *str2 = NULL;

str1 = ori_str;
str2 = strchr(str1, '$');
printf("$的位置是:\n");
printf("%d\n",(int)(str2 - str1+1));
char *str3 =NULL;
str3 = strchr(str1,687.81);

double d;
char *str3Ptr;
d=strtod(str3,&str3Ptr);
printf("The str3"%s" is converted to the \n",str3);
printf("double value %.2f");

return 0;

}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
    char ori_str[] = "You will pay $687.71 every month for 15 years to payoff the debt";
    char *str1 = NULL;
    char *str2 = NULL;
    double value = 0.0;
    
    str1 = ori_str;
    str2 = strchr(str1, '$');
    printf("$的位置是:\n");
    printf("%d\n",(int)(str2 - str1+1));
    
    value = atof(str2 + 1);
    printf("double value %.2f",value);
    
    return 0;
}

使用atoi函数(字符串转int)或者atof函数(字符串转float)