c 代码复制后出现问题 大一水平 求大佬们帮帮忙

https://www.jianshu.com/p/ba0282bb87a0 这个链接里的源代码 我在dev 等平台试了 都没问题 在vs2017跳出这个 请问 大佬们咋回事图片说明

最好还是使用VS2013,VS2015的版本,问题不多,而且支持C++11.

vs2017不能用scanf的把,你可以在#include 下面加入 #pragma warning (disable : 4996)

http://download.csdn.net/download/u010368556/10238145
这是我用的vs2013专业版,你可以试试!

如果你能编译,就和scanf能不能用无关。vc++ 2010+以上之所以不能用scanf是因为它是不安全的,所以在编译器限制了。如果这个限制存在,根本不能编译,不要说运行了。
你的输入是否有问题,或者这个程序有问题。你这个是内存越界。

目前vs2017还是没什么问题啊,看你截图代码在什么地方冲突了吧

char line[10000], *p = line; //这一行,line还没有显式的初始化吧。
scanf("%[^E]E%d", line, &exponent); //输入数据时,line可能会重新分配地址,此时 *p并不一定会指向line

后续引用*p时会出现问题。 可能VS版本不一样,对局部变量的处理不同。简单加上static char line试下。

VS默认和这个代码冲突了,你是不是在调试

#define use _CRT_SECURE_NO_WARNINGS 1
把这句话放在代码最开始就好。

 #include <stdio.h>
int main()
{
    int exponent;    /* the exponent part */
    char line[10000], *p = line;
    scanf("%[^E]E%d", line, &exponent);

    if(*p++ == '-') putchar('-');
    if(exponent >= 0)   /* print '.' later or add zeros in the end */
    {
        putchar(*p);
        for(p += 2; exponent; exponent--)    /* print the integer part */
            putchar(*p ? *p++ : '0');
        if(*p)                               /* there is still fraction part */
        {
            putchar('.');
            while(*p) 
                putchar(*p++);
        }
    }
    if(exponent < 0)    /* add exponent zeros in the beginning */
    {
        printf("0.");
        for(exponent++; exponent; exponent++)       /* add zeros */
            putchar('0');
        for(; *p; p++) if(*p != '.') putchar(*p);   /* the rest */
    }

    return 0;
}

我在dev和2010上跑都完美运行