#include <stdio.h> #include <stdlib.h> #include <locale.h> int main() { setlocale(LC_ALL, "Russian"); int n = 1; double l; printf("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ Π΄Π»ΠΈΠ½Ρƒ ΠΎΡ‚Ρ€Π΅Π·ΠΊΠ°: "); scanf("%d", &l); do { printf("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ Π΅Π΄ΠΈΠ½ΠΈΡ†Ρƒ измСрСния Π΄Π»ΠΈΠ½Ρ‹, Π³Π΄Π΅ \n1 - Π΄Π΅Ρ†ΠΈΠΌΠ΅Ρ‚Ρ€,\n2 - ΠΊΠΈΠ»ΠΎΠΌΠ΅Ρ‚Ρ€,\n3 - ΠΌΠ΅Ρ‚Ρ€,\n4 - ΠΌΠΈΠ»Π»ΠΈΠΌΠ΅Ρ‚Ρ€,\n5 - сантимСтр \n"); scanf("%d", &n); switch(n) { case 1: printf("Π”Π»ΠΈΠ½Π° ΠΎΡ‚Ρ€Π΅Π·ΠΊΠ° - %lf ΠΌΠ΅Ρ‚Ρ€ΠΎΠ². \n", l/10.0); break; case 2: printf("Π”Π»ΠΈΠ½Π° ΠΎΡ‚Ρ€Π΅Π·ΠΊΠ° - %d ΠΌΠ΅Ρ‚Ρ€ΠΎΠ². \n", l*10); break; case 3: printf("Π”Π»ΠΈΠ½Π° ΠΎΡ‚Ρ€Π΅Π·ΠΊΠ° - %d ΠΌΠ΅Ρ‚Ρ€ΠΎΠ². \n", l); break; case 4: printf("Π”Π»ΠΈΠ½Π° ΠΎΡ‚Ρ€Π΅Π·ΠΊΠ° - %lf ΠΌΠ΅Ρ‚Ρ€ΠΎΠ². \n", l/1000.0); break; case 5: printf("Π”Π»ΠΈΠ½Π° ΠΎΡ‚Ρ€Π΅Π·ΠΊΠ° - %lf ΠΌΠ΅Ρ‚Ρ€ΠΎΠ². \n", l/100.0); break; default: printf("Ошибка. ΠŸΠΎΠ²Ρ‚ΠΎΡ€ΠΈΡ‚Π΅ Π²Π²ΠΎΠ΄. \n"); } } while (n>5 || n < 1); system("pause"); return 1; } 

Closed due to the fact that off-topic participants ߊߚ߀ߘ , Kromster , Denis Bubnov , m9_psy , vp_arth 13 Apr '17 at 20:58 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reasons:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - ߊߚ߀ߘ, m9_psy, vp_arth
  • β€œQuestions asking for help with debugging (β€œ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Kromster, Denis Bubnov
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    Why don't you use the debugger? - VladD
  • @VladD, but many people do not like to use it: D - nick
  • @VladD do not know how to use it because I write in Dev C ++. - A. Leontiev
  • And what, debug output already canceled? Or do you think that the first thing that was written for some ENIAK is a debugger? - Harry
  • @Harry Thanks for the tip! I will have to use it in the future, since I make such ridiculous mistakes. - A. Leontiev

1 answer 1

The error was in this line:

 scanf("%d", &l); 

The double variable l was assigned the specifier % d. -___-

  • You and printf similar errors, which, by the way, the compiler usually reports. - zed
  • @zed Thanks, corrected. - A. Leontiev