Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
TBod new
#include <stdio.h> #include <math.h> struct TBod { float iX; //male i znamena interni promenna struktury, pro lepsi orientaci float iY; }; // strednik zde musi byt !!! inline float vzdalenost(struct TBod aBod) { return sqrtf((aBod.iX * aBod.iX) + (aBod.iY * aBod.iY)); } inline float vzdalenost2Bodu(struct TBod aBod, struct TBod bBod) { float dx, dy; dy = aBod.iY - bBod.iY; dx = aBod.iX - bBod.iX; //return sqrt((dx * dx) + (dy * dy)); return vzdalenost((struct TBod){.iX = dx, .iY = dy}); } int main() { //https://www.geeksforgeeks.org/designated-initializers-c/ struct TBod bod = {.iY = 0, .iX = 0}; //T = strukTura (typ) struct TBod bod2 = {.iY = 2, .iX = 3}; printf("Ahoj z BPC-UDP\n"); printf("bod.iX = %f\n", bod.iX); printf("bod.iY = %f\n", bod.iY); if(scanf("%f%f", &bod.iX, &bod.iY) != 2) //antidebilní filtr { printf("Chybne parametry, konec programu.\n"); return 1; } printf("bod.iX = %f\n", bod.iX); printf("bod.iY = %f\n", bod.iY); printf("bod2.iX = %f\n", bod2.iX); printf("bod2.iY = %f\n", bod2.iY); float r = vzdalenost(bod); //bod je promenna typu struktura float q = vzdalenost2Bodu(bod, bod2); //bod je promenna typu struktura printf("Vzdalemnost A od nuly %f, vzdalenost A a B je %f\n", r, q); return 0; } #if 0 // Trolls start here.... ( ͡° ͜ʖ ͡°) ( ͡ಠ ʖ̯ ͡ಠ) ¯\_(ツ)_/¯ ( ཀ ʖ̯ ཀ) ( ಠ╭╮ಠ ) ( × ʖ̯ × ) ( ͡° ʖ̯ ͡°) ༼ つ ◕_◕ ༽つ (.)(.) (ಠ_ಠ) ╔╗╔╗╔╗╔╗╔╗ tak se citim celej zivot - feels bad man ╚╤══════╤╝ , je mi hodne ╔╗╔╗╔╗│─╔╗╔╗─│╔╗╔╗╔╗ ║╚╝╚╝║│─╚╝╚╝─│║╚╝╚╝║ my jsme uplně hotoví - to teda :c ╚╤══╤╝│──────│╚╤══╤╝ │╔╗╞╗│╔╗╔╗╔╗│╔╡╔╗│ ZDENOOOO, je tady Zdena? Neni porad pod korenem? Koren byl zabit. F F F │╚╝│╚╪╝╚╝╚╝╚╪╝│╚╝│ METLOOOO │╔╗│─│╔═╤╤═╗│─│╔╗│ Svarto,je ti něco? │╚╝│─│║─││─║│─│╚╝│ │──│─│║─││─║│─│──│není mu nic 2TB mám ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ #endif
run
|
edit
|
history
|
help
0
TStack_list
Look at the bleeping warnings
test
Check Expression with Stack
"Neon" Text Loop. My First Proggam :)
Cross Platform Support for sprintf's Format '-Flag
crackme
BPC cv 5_Test
array of structures
Stack