2/27/2011

DCT1063 Programming 2

ASSIGNMENT 2


 

  1. Explain the purpose of following function.


     

No 

Function

Purpose 

0 

strcpy 

Copies the string pointed by source into the array pointed by destination, including the terminating null character.

1 

strlen 

 

2 

strcmp 

 

3 

strcpy 

 

4 

strncpy 

 

5 

strcat 

 

6 

isalnum 

 

7 

islower 

 

8 

isspace 

 

9 

tolower 

 

10 

toupper 

 


 


 


 

  1. Write a program that reads one line of text and then prints it with all letters capitalized.


 

Input:        Abu Bakar

Output:    ABU BAKAR


 

3.     Write a program that separately inputs a first name and a last name and concatenates the two into a new string.


 

4. Write a program that reads one line of text and then prints the text in reverse order. For example, the input

today is tuesday

Would produce the output

yadseut si yadot


 

5.    Write a program that reads one line of text and then prints it with all its 'a','e', 'i', 'o', 'u','A','E', 'I', 'O', 'U' removed.

For example:

Input:        A structure (struct) type is a user defined composite type.

Output:    strctur (strct) typ is sr dfnd cmpsit typ.


 


 

6.     Write a program that counts the total number of vowels in a sentence. Output the frequency of each vowel.

For example:

Input:        A structure (struct) type is a user defined composite type.

Output:    A    :    2

        E    :    5

        I    :    3

        O    :    1

        U    :    4


 

7.    Write a program that reads one line of text and then prints the numbers of four-letter words that were read.


 

Input:        A structure (struct) type is a user defined composite type.

Output:    Number of words with four letter =3.


 


 


 


 

No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...