解决VS2013中出现类似于error C4996: 'scanf': This function or variable may be unsafe的安全检查错误

//解决VS2013中出现类似于error C4996: 'scanf': This function or variable may be unsafe的安全检查错误 https://blog.csdn.net/dan15188387481/article/details/49622783/


//#pragma warning( disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
# include <string.h>
# define DENSITY 62.4
#define ESC '65'

#include <stdio.h>
#include <limits.h> // integer limits
#include <float.h> // floating-point limits

int main(void)
{
/****************
float aboat = 32000.0;
double abet = 2.14e+9;
long double dip = 5.32e-5;

printf("%f can be written %e ", aboat, aboat);
printf("%f can be written %e ", abet, abet);
printf("%f can be written %e ", dip, dip);

float toobig = 3.4E38 * 100.0f;
printf("%e ", toobig);

char beep = '07';
//char some = '32';
char some = '32';
printf("beep is %c ", beep);
printf("some is%c space ", some);

//转义序列
float salary;
printf("aEnter your desired monthly salary: ");
printf(" $_______");
scanf("%f", &salary);
printf(" $%.2f a month is $%.2f a year.", salary, salary * 12.0);
printf(" Gee! ");

int f = 4;
int g = 5;
float h = 5.0f;
printf("%d ", f, g);
printf("%d %d ", f);
printf("%d %f ", h, g);

**************/

/*********************************
float weight, volume;
int size, letters;
char name[40];

printf("Hi What's your first name? ");
scanf("%s", name);
printf("%s, what's your weight in pounds? ", name);
scanf("%f", &weight);
size = sizeof(name);
letters = strlen(name);
volume = weight / DENSITY;

printf("Well, %s, your volume is 2.2%f cubic feet. ", name, volume);
printf("Also, your first name has %d letters, ", letters);
printf("and we have % d bytes to store it in. ", size);

printf("ESC %c ", ESC);
printf("%c ", '53');



printf("Some number limits for this system: ");
printf("Biggest int: %d ", INT_MAX);
printf("Smallest long long: %lld ", LLONG_MIN);
printf("One byte = %d bits on this system. ", CHAR_BIT);
printf("Largest double: %e ", DBL_MAX);
printf("Smallest normal float: %e ", FLT_MIN);
printf("float precision = %d digits ", FLT_DIG);
printf("float epsilon = %e ", FLT_EPSILON);

**********************************/

/**********************************
int bph = 212;
int rv;
rv = printf("%dF", bph);
printf("The printf() function printed %d characters. ", rv);

printf("Here's the newest way to print a"
" long string. ");

char aaa;
scanf("%c", &aaa);
printf("%c", aaa);
**********************************/

int n = 0;
size_t intsize;
intsize = sizeof(int);
printf("n=%d, n has %zd bytes; all ints have %zd bytes. ", n, sizeof n, intsize);

printf("-11%%-5 = %d", -11 % -5);

return 0;
}

原文地址:https://www.cnblogs.com/Thermo/p/15346859.html