functions class11 cbse_notes

2
1. Library: It is a collection of files that your programs may use called header files. Header files provide function prototypes, definitions of library functions, data types and constants. 2. Header files: a. stdio.h: Defines types and macros for standard I/O package. Also defines I/O predefined streams. b. String.h: Declares several string manipulation and memory manipulation routines. All functions starting with str and mem c. Math.h: Declares prototypes for math functions and math error handlers. The routines perform mathematical calculations and conversions. d. Stdlib.h: Declares several commonly used routines like conversion routines, search/sort routines and other miscellaneous things. Ex: free, labs, atof, atoi, atoll. e. Iostream.h: Declares basic C++ streams I/O routines. Ex: open, close, get, write. f. Iomanip.h: Declares C++ streams I/O manipulators and contains macros for creating parameterised manipulators. Ex: dec, endl, ends, hex, oct. 3. Character functions: a. Isalnum: Returns non zero if arg is letter or digit. Ex: if(isalnum(ch)) cout<<Alpha; b. Isalpha: returns non zero if ch is an alphabet. c. Isdigit: Returns non zero if ch is digit. d. Islower: returns non zero if ch is a lowercase letter e. Isupper: Returns non zero if ch is uppercase letter f. Toupper: Returns uppercase equivalent of ch g. Tolower: Returns lowercase equivalent of ch 4. String functions: a. Strcat(str2, str1): Concatenates a copy of str2 to str1 and terminates str1 with a null. b. Strcmp(str2,str1): Compares two strings and returns –ve value if str1<str2 and positive value if str1>str2 c. Strcpy(str1,str2): Copies contents of str2 to str1 d. Strlen(str): Returns length of null terminated string. Null is not counted. 5. Math functions: a. Fabs(x): returns absolute value of floating point number b. Modf(x,y): returns the remainder of x/y. 6. Random and Randomize functions: Two macros of stdlib.h having similar functioning as rand() and srand()

Upload: krishnaprasad-arumugam

Post on 11-Jun-2015

58 views

Category:

Education


2 download

DESCRIPTION

Notes prepared for funcions for CLass 11 CBSE students

TRANSCRIPT

Page 1: Functions class11 cbse_notes

1. Library: It is a collection of files that your programs may use called header files. Header files provide function prototypes, definitions of library functions, data types and constants.

2. Header files:a. stdio.h: Defines types and macros for standard I/O package. Also defines I/O

predefined streams. b. String.h: Declares several string manipulation and memory manipulation routines. All

functions starting with str and memc. Math.h: Declares prototypes for math functions and math error handlers. The routines

perform mathematical calculations and conversions.d. Stdlib.h: Declares several commonly used routines like conversion routines,

search/sort routines and other miscellaneous things. Ex: free, labs, atof, atoi, atoll.e. Iostream.h: Declares basic C++ streams I/O routines. Ex: open, close, get, write.f. Iomanip.h: Declares C++ streams I/O manipulators and contains macros for creating

parameterised manipulators. Ex: dec, endl, ends, hex, oct.3. Character functions:

a. Isalnum: Returns non zero if arg is letter or digit. Ex: if(isalnum(ch)) cout<<Alpha;b. Isalpha: returns non zero if ch is an alphabet.c. Isdigit: Returns non zero if ch is digit.d. Islower: returns non zero if ch is a lowercase lettere. Isupper: Returns non zero if ch is uppercase letterf. Toupper: Returns uppercase equivalent of chg. Tolower: Returns lowercase equivalent of ch

4. String functions:a. Strcat(str2, str1): Concatenates a copy of str2 to str1 and terminates str1 with a null. b. Strcmp(str2,str1): Compares two strings and returns –ve value if str1<str2 and

positive value if str1>str2c. Strcpy(str1,str2): Copies contents of str2 to str1d. Strlen(str): Returns length of null terminated string. Null is not counted.

5. Math functions:a. Fabs(x): returns absolute value of floating point numberb. Modf(x,y): returns the remainder of x/y.

6. Random and Randomize functions: Two macros of stdlib.h having similar functioning as rand() and srand()

a. Random: Generates a random number within range 0 to number – 1. b. Randomize: It initializes or seeds the random number generator with a random

number.