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 - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)

4,100 views

Published on

Α. Χαρακτήρες
1) Ο τύπος δεδομένων char
2) O πίνακας ASCII
3) Χρήση Μεταβλητών τύπου char

Β. Συμβολοσειρές
1) Τι είναι η συμβολοσειρά
2) Διάβασμα και Εκτύπωση Συμβολοσειράς
3) Οι συναρτήσεις gets και puts
4) Η βιβλιοθήκη string.h

Γ. Ασκήσεις

Published in: Education
  • Be the first to comment

  • Be the first to like this

ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)

  1. 1. H C 10: . 1. char 2. O ASCII 3. char . 1. 2. ! 3. gets puts 4. " # string.h $. ! " # . 1. ! " # # $ char C " # # $ char " % & " . " & $ # " ! ' # # " ( ! ) % % " 0 * 255. + " % ( "% , & "% $ ASCII $# * , " % % '" & $ # % , %, " % , ($ "% ASCII. - " " . : char " % $ , $ char " % $ , $ $! " # A. 2. ! "% ASCII %! " # % " % % "% $ ASCII. / # ( % " % . .
  2. 2. A. 3. * " char &! " # * # $ : ch ". . a " # " : 0% $ % ASCII $# : 0% $ " : ! ' " % , " " " $ & 1 &$& ! 0"% " # " printf & " # # $ % %c. ) " "* : char ch; ch=97; ch='a'; printf("%c",ch); A. 3. * " char '! " # / . " & " # % "$ " %, " & C /* char.c */ #include <stdio.h> main() { char c; for (c=80; c<=100; c++) { printf("nO xaraktiras %d einai %c",c,c); } } * & "$ ASCII 128-255 " " # * c unsigned char. 2. 1. / % (! " # " " " * & " % " % " . % , # # % " . C &% # * " "% " . ) # $ : * "% " 20 , " 19 $ . 3! ! 4! 0% " 19 $ ( 20) # " " %, # 0 (slash # ). " # & «hello» " $ . : char str[20]; str[0] str[1] str[2] str[3] … str[4] str[5] h e l l o 0 str[20] 2. 1. / % )! " # 4 " % " % &% # $ " : & $ " " % # . : 0"% & ( " , " * # " &$& + " " # " % * ( " # & 3 : $ # * " $ # % , # " " " " ( " ( ) char pin[3]={'a','b','0'}; char pin[3]="ab"; char *pin="ab"; char pin[]="ab";
  3. 3. 2. 2. 0 "$ % *! " # "$ ( printf) & $ ( scanf) " % " # %s. " " % " %! % % "% $ , ( % "% , % # % # . . ) scanf # " " & . " # & # * % : / "$ &% : 0 * # &% : char string[100]; printf("%s",string); scanf("%s",string); 2. 2. 0 "$ % ! " # / . " & & % # " * «teststring» " «test string» (" * $ % ) # % " . /* string.c: Deixnei tin xrisi tis scanf kai tis printf me simvoloseires */ #include <stdio.h> main() { char string[80]; printf("Dwste mia simboloseira: "); scanf("%s",string); printf("Pliktrologisate tin simvoloseira: %s",string); } 2. 3. ! gets puts ! " # ' & % scanf, # , " & & " & " * " & . " " & ( , " gets " " $ " : 4 " string " # , " , " . 0% : %# %, puts " "* " # $ " ‘n’: "% % char *gets(char *string) int puts(char *string) stdio.h stdio.h 2. 4. 4 string.h ! " # 0%# % " * &$& . 0" # # % * % # # % C, % % , : " % %, " " " . & % * . 0 % %, "$ : 4 " % & ( src dest. + : " ( " $ $ string. 5 # " string.h int strlen(char *string) void strcpy(char *dest, char *src)
  4. 4. . 1. $! " # / " $ $ ( # 0) ( . + % " $ " int mystrlen(char *s) " # $ % " ( . 1 " & C, " % # , " % # gets " " &%, "* 4 int strlen(char *s) " % string.h % * & " " & ( " " $. . 2. & ( * %! " # + % " $ " char *mystrcpy(char *dest, char *src) " # $ % # & ( src dest. 4 " ( # % dest. 1 " & C, " % # , " % # # gets " #% % " & & & 1 " " # " % % % . / "* . 4 char *strcpy(char *dest, char *src) " % string.h % * & " " & ( " " $. . 3. " + ( % &! " # 1 " & " # , " " & % ( % "* " 6" # %. : * % & (". . 150 $ ) " "% $ ASCII # ( " % ( % 32 * . ( % , " % %. "* % "% ASCII & # % " % %. " ( % " gets scanf & " & . . 4. ( " % 0. # '! " # % 2 " $ "% ASCII (128-255) " " " # " & " " % " % . " & "* ( ,% " ): Hello World!Hello World!
  5. 5. . 5. & * (! " # + " & C " % : 7 # , # . ( " & " % & " & ) 7 " & " % ( & $ * "* . # & " : Dwse tin 1i simvoloseira: test Dwse tin 2i simvoloseira: abba ===== Isxyei: abba < test & " % int strcmp(char *s1, char *s2) string.h " % "

×