Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
struktura vzalenost
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <stdio.h> #include <math.h> struct TBod { float iX; float iY; }; // !!! zde musí být středník inline float vzdalenost(struct TBod aBod) { return sqrt((aBod.iX * aBod.iX) + (aBod.iY * aBod.iY)); } int main() { struct TBod bod = { .iX = 0, .iY = 0, }; // struct - typ, bod - promněná printf ("bpd.iX = %f\n", bod.iX); printf ("bpd.iY = %f\n", bod.iY); if(scanf("%f%f", &bod.iX, &bod.iY) != 2) // != čte kolik parametrů načetl scanf, pokud načetl jiný počet než 2 promněné tak ukončí program { printf("Chybne parametry, konec programu.\n"); return 1; } printf ("bpd.iX = %f\n", bod.iX); printf ("bpd.iY = %f\n", bod.iY); float r = vzdalenost(bod); //bod je proměná typu struct(ura) printf("%f\n", r); return 0; }
cl.exe
10 20
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 1,63 sec, absolute running time: 0,23 sec, absolute service time: 1,87 sec
edit mode
|
history
|
discussion
bpd.iX = 0.000000 bpd.iY = 0.000000 bpd.iX = 10.000000 bpd.iY = 20.000000 22.360680