Monday, September 22, 2014

[Delivery] Character array

Bài 1: Write a program which prints the letters in a char array in reverse order. For example, if the array contains {'c', 's', 'c', '2', '6', '1'}the output (to the terminal) should be "162csc".


My code + result

Bài 2: Write a  program : declare a char array and the size of the array (of type char). This function counts the number of digit letters in the char array.


My code + result

Bài 3: Write a program that counts the number of words in a string.


My code + result

Bài 4: Write a program that accept two string, after checking if string1 equals string2 then print 'string 1 equals string2', else print string1 less than or greater than string 2.


My code + result

Bài 5: Write a function that scans a character array for the character - and replaces it with _.


My code + result


Bài học rút ra:

  • Cách dùng #define để đặt giá trị cho size của mảng 
  • Cấu trúc : puts(), gets()
  • Cấu trúc mảng : storage_class data_type array_name[size_expr]

No comments:

Post a Comment