1 / 34

Pvz .: math.h

Pvz .: math.h. /* cos example */ # include &lt; stdio.h &gt; /* printf */ # include &lt; math.h &gt; /* cos */ # define PI 3.14159265 int main () { double param , result ; param = 60.0; result = cos ( param * PI / 180.0 ); printf (&quot; The cosine of %f degrees is % f.<br> &quot;,

cady
Download Presentation

Pvz .: math.h

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pvz.: math.h /* cosexample */ #include <stdio.h> /* printf */ #include <math.h> /* cos */ #define PI 3.14159265 intmain () { doubleparam, result; param = 60.0; result= cos ( param * PI / 180.0 ); printf("Thecosineof %f degreesis %f.\n",\ param, result ); return0; }

  2. voidtipas funkcijoje /* spausdinimo funkcija*/ /* x, y and z are parameters */ voidmaximum( int x, int y, int z ) /*F-jos pradžia */ { intmax = x; /* laikome, kad x yra didiausias*/ if ( y > max ) { /* jeigu y yra didesnis už max, priskirti y reikšmę kintamajam max */ max = y; } /* if pabaiga */ if ( z > max ) {/* jeigu z yra didesnis už max, priskirti z reikšmę kintamajam max */ max = z; } /* if pabaiga */ Printf(“\n %d yra didziausiaiisskaiciu\n \ (%d %d %d)“, max, x, y, z); /* nėra returnsakinio */ } /*F-jos pabaiga*/ Prototipas bus: voidmaximum( int x, int y, int z ); arba voidmaximum( int, int, int);

  3. intmain(){ /* main() [radžia */ int a, a10, a11, a5 = 5, a7 = 7, am3 = -3; ... ... ... a11 = maximum( 5, 7, -3 ); a10 = maximum( a5, a7, am3 ); maximum1( a5, a7, am3, &a); ... } /* main() pabaiga */ voidmaximum1( int x, int y, intz, int &a ) /*F-jos pradžia */ { intmax = x; /* laikome, kad x yra didiausias*/ if ( y > max ) { /* jeigu y yra didesnis už max, priskirti y reikšmę kintamajam max */ max = y; } /* if pabaiga */ if ( z > max ) {/* jeigu z yra didesnis už max, priskirti z reikšmę kintamajam max */ max = z; } /* if pabaiga */ a = max; /* nėra returnsakinio */ } /*F-jos pabaiga*/

More Related