1 / 14

STANDARD LIBRARY FUNTION

STANDARD LIBRARY FUNTION. NAME- SHREYA BHOWMiK CLASS- XI SEC- B ROLL- 10. INTRODUCTION.

obelia
Download Presentation

STANDARD LIBRARY FUNTION

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. STANDARD LIBRARY FUNTION NAME-SHREYA BHOWMiK CLASS-XISEC-B ROLL-10

  2. INTRODUCTION Various function (that are not part of basic C++ language)that help perform I/O operations ,that can’t be directly performed using C++ basic statements, are stored together in form of library. these stored functions can be called and used for the desired operations. LIBRARY- A library is a collection of subprograms used to develop other programs and software. they are not independent programs, rather they are helper code used in other independent program. The C++ of functions store functions of same category under separate files known as header files.

  3. stdio.h This header file defines types and macros needed for the standard I/O package and also defines the standard I/O predefined streams.the standard I/O function contained in stdio.h are given below:

  4. string.h This header file declares several string manipulations and memory manipulation routines. the functions contained in string.h are :

  5. math.h This header file declares for the math functions and math error handlers.

  6. stdlib.h This header file declares several commonly used routines like conversion routines , search / sort routines , and other miscellaneous things.

  7. iostream.h This header file declares the basic C++ streams routines.

  8. iomanip.h This file declares the C++ streams I/O manipulators and contains macros for creating parameterized manipulators.

  9. String and character related function In a standard implementation, the string function require the header file string.h to provide their prototype. The character functions use ctype.h as their header file.

  10. CHARACTER FUNTION NOTE: -The type of all the arguments is int because internally al l the characters are processed numerically i.e, through their ASCII value.

  11. STRING FUNCTION NOTE: - String must be included as header file.

  12. There are two function random( ) and randomized( ), which are used for generating random numbers. Two other functions rand( ) and srand ( ) also perform similar task. GENERATING RANDOM NUMBERS IN C++ To generate random numbers we need to use rand( ) function that produces a random number in the range to RAND_MAX.the RAND_MAX is also defined in stdlib.h which gives us the maximum value returned by rand( ).if we want to generate different random numbers everytime , we use srand( ) function. The srand( ) function start or seeds the random-numbers generator from a point that depends on the value we pass to srand( ) as argument. Therefore to generate different random numbers everytime, we should seed the generator with a truly variable value such as system time. NOTE: - srand( ) should be involved just once prior to the loop and not everything before generating a random number through rand( ).

  13. RANDOM AND RANDOMIZE random( ) and randomize( ) are two other macros of stdlib.h having similar function as rand( )& srand( ) respectively. random(num) generates a random number within range 0 to num-1,e.g., random(10) will generate random number within range 0-9. To generate a random within a specific no.within a specific range (L to U) through random( ),we need to change the use of random( ) to: random(U-L+1)+L therefore randomize( ) initializes/seeds the random number generator with a random number. NOTE: - to use randomize ( ),we should include include<Time.h> as randomize( ) internally implement a macro that calls time function of time.h.  Eg. #include<iostream.h> #include<stdlib.h> void main() { randomize( ); int Num,Rndnum; cin>>Num; Rndnum=random(num)+7; for(int N=1;N<=Rndnum;N++) cout<<N<<” “; }

  14. THE END

More Related