Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Η ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 16 - ΣΥΝΑΡΤΗΣΕΙΣ ΕΞΟΔΟΥ

1,596 views

Published on

.

Published in: Education
  • Be the first to comment

  • Be the first to like this

Η ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 16 - ΣΥΝΑΡΤΗΣΕΙΣ ΕΞΟΔΟΥ

  1. 1. H C 16: / : E A. stdout 1. 2. putchar() 3. putc() fputc() 4. puts() fputs() 5. printf() fprintf() B. ! "# $% !& # A. ! 1. " '! "# $% !& # # " $ C, % $ & ' (streams). " ( " & ) % ) ( % $( . * ( & % & + ) $ ) $ : , ) " $ (stdin) ) ) - + " ) )( " ( % . (stdout) . stdout stdin A. ! 1. " (! "# $% !& # H C ) $ ) % $ ) .( $ stdio.h , " % & & : / ) )' $ " : $ putchar, putc " fputc / ) )' - ( : $ puts " fputs 0 ) )' ( ) ) : $ printf " fprintf / $ $( " stdout
  2. 2. A. ! 2. # putchar() )! "# $% !& # , ) & ) putchar : 0 $ - -( " : # $ $ ASCII "& " & " ) - (( " . ) $1 " ) % 1 " EOF ) ) & ( . int putchar(int ch) stdio.h A. ! 2. # putchar() ! "# $% !& # , ) " & ) % " putchar . /* putchar.c: Epideiksi tis putchar */ #include <stdio.h> main() { int i; for (i=40; i<100; i++) putchar(i); } A. ! 3. / fputc() " putc() *! "# $% !& # , ) & ) getch : 0 $ - -( " : , ) ' $ ASCII "& " , ) $) stdout. & : 2 ) % )' $ " ( ) ) # ) 1 putchar() $ : 0 $ : int fputc(int c, FILE *fp) stdio.h int putc(int c, FILE *fp) stdio.h A. ! 3. / fputc() " putc() +! "# $% !& # , ) " & ) % " getch #include <stdio.h> main() { int i; for (i=40; i<100; i++) fputc(i,stdout); }
  3. 3. A. ! 4. / puts() " fputs() ,! "# $% !& # , ) & ) fputs : 0 $ - -( " : , ) ' - ( () " " & ) , ) $) stdout. & : 2 ) % )' - ( ( ) ) H )' - ( s ( $ " 0) " (( + % ! ) $1 1 ( ) % " ( , " EOF ) ) & ( . $ : 0 $ : int fputs(char *s, FILE *fp) stdio.h int puts(char *s) stdio.h A. ! 4. / puts() " fputs() -! "# $% !& # , " ( ) % " « ) $ » " )& : /* puts.c: Epideiksi tis puts */ #include <stdio.h> main() { int i; char *s="Hello World!"; puts(s); puts("-----------------"); for (i=0; i<100; i++) { puts(&s[i]); if (s[i]=='0') break; } } A. ! 5. / printf() " fprintf() ! "# $% !& # , ) & ) printf : 0 $ - -( " : 1 ' ( « 9: %&% / $ & » ! + : 0 $ - -( " : # ( % ) printf (( ) )' " , )& ) ! $ - + ) ' to “stdout” int printf ( const char * format, ... ); stdio.h int fprintf (FILE *fp, const char * format, ... ); stdio.h A. ! 5. / printf() " fprintf() ! "# $% !& # , " ( ) % " « ) $ » " )& : /* fprintf.c: Epideiksi tis puts */ #include <stdio.h> main() { int i; for (i=0; i<100; i++) { fprintf(stdout,"n%d*%d*%d=%d",i,i,i,i*i*i); } }
  4. 4. 3. " 1. - ( ' '! "# $% !& # 4 $ ) % ) : 1. 5 - + - ( ) . 2. 5 )' - ( . , ) % ) & " ) $) ) gets " puts (" $ ) 3. " 2. - ( ' (! "# $% !& # 4 $ ) % ) : 1. 5 - + - ( ) . 2. 5 )' - ( . , ) % ) & " ) $) ) getchar " putchar (" $ ) 3. " 3. - ( ' )! "# $% !& # 4 $ ) % ) : 1. 5 - + - ( ) . 2. 5 )' - ( . , ) % ) & " ) $) ) scanf " printf (" $ )

×