B
B
Ben_r0072020-05-25 17:58:31
C++ / C#
Ben_r007, 2020-05-25 17:58:31

scanf. How to disable Security Development Lifecycle in VS 2019?

Hello.
I am writing a C program in VS 2019. I created a C ++ project, selected C code in the project settings, created the main.c file.
Swears on Scanf. Showed to a friend, he said that you need to turn off the Security Lifecycle. But I don't have this item when creating the project.
How can you turn it off?
Thanks in advance!

The code:

#include <stdio.h>
#include <string.h>
#include <windows.h>
#define MAX 10
#define KOL 15

struct Student
{
    char Name[KOL];
    int Age;
    float AverageRaiting;
    struct Student* nextStudent;
};

void InitStudentList(struct Student** student)
{
    *student = (struct Student*)
        malloc(sizeof(struct Student));
    printf("Введіть ім’я 1-го студента: ");
    scanf("%s", (*student)->Name);
    printf("Введіть вік 1-го студента: ");
    scanf("%d", &(*student)->Age);
    printf("Введіть середній рейтинг 1-го студента: ");
    scanf("%f", &(*student)->AverageRaiting);
    printf("\n");
    (*student)->nextStudent = NULL;
    struct Student* endStudent = *student;
    for (int i = 2; i <= MAX; i++)
    {
        endStudent->nextStudent =
            (struct Student*) malloc(sizeof(struct Student));
        endStudent = endStudent->nextStudent;
        printf("Введіть ім’я %d-го студента: ", i);
        scanf("%s", endStudent->Name);
        printf("Введіть вік %d-го студента: ", i);
        scanf("%d", &endStudent->Age);
        printf("Введіть середній рейтинг %d-го студента: ", i);
        scanf("%f", &endStudent->AverageRaiting);
        printf("\n");
        endStudent->nextStudent = NULL;
    }
}
void PrintList(struct Student* student)
{
    struct Student* printStudent = student;
    printf("==========================\n");
    printf("Ім’я         Вік  Рейтинг \n");
    printf("==========================\n");
    while (printStudent)
    {
        printf("%-15s", printStudent->Name);
        printf("%4d", printStudent->Age);
        printf("%8.2f", printStudent->AverageRaiting);
        printf("\n");
        printStudent = printStudent->nextStudent;
    }
    printf("==========================\n");
}

void FreeList(struct Student** student)
{
    if (*student == NULL)
        return;
    struct Student* tmp = *student;
    struct Student* curr_stud;
    while (tmp)
    {
        curr_stud = tmp;
        tmp = tmp->nextStudent;
        free(curr_stud);
    }
    *student = NULL;
}

int main(void)
{
    struct Student* BaseStudent = NULL;
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);
    InitStudentList(&BaseStudent);
    PrintList(BaseStudent);
    FreeList(&BaseStudent);
    return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2020-05-25
@SaNNy32

https://stackoverflow.com/questions/16883037/remov...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question