Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

0
_CRT_SECURE_NO_WARNINGS does not seem to be working
Post Body

hello all, I am taking an intro to programming course and am finding an issue with one of my labs. it is a BMI calculator program. Below is what I have so far but when i build it to test it out i get "return value ignored scanf for line 16 and 18. for line 17 and 19 i get "scanf this function may be unsafe consider using scanf_s instead. to disable deprecation use CRT SCURE NOT WARNINGS.

I have that included as you can see but still get the same answer. i dont know what i am missing, or even if the title of my post is correct. I am only 7 weeks in to my course and have been struggling a bit anyways.

I also tried plugging the code into chatgpt but it did not help.

#define _CRT_SCURE_NO_WARNINGS

#include <stdio.h>

int main()

{

float weight, height, bmi;

printf("\\n\\t Enter Weight in lbs\\t");

scanf("%f", &weight);

printf("\\n\\t Enter height in inches\\t");

scanf("%f", &height);

bmi = weight / (height \* height);

if (bmi <= 18.5)

{

    printf("BMI is : %.22f -> Underweight", bmi);

}

else if (bmi <= 24.9)

{

    printf("BMI is : %.2f -> Normal", bmi);

}

else if (bmi >= 25 && bmi <= 29.9)

{

    printf("BMI is : %.2f -> Overweight", bmi);

}

else

    printf("BMI is : %.2f -> Obese", bmi);

return 0;

}

Author
Account Strength
90%
Account Age
4 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,542
Link Karma
633
Comment Karma
909
Profile updated: 3 days ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 months ago