Program to illustrate the atoi( ) function


#include<iostream.h>
#include<conio.h>
#include<stdlib.h >
     // defines the atoi( ) function

void main()
{
    int i ;
    char *string = "145.97" ;
    i = atoi ( string ) ;
    cout<< "string = "<<string<<"\t integer = "<<i;
    getch ( ) ;
}

No comments:

Post a Comment