Inbuilt functions in cpp, C/C++ Programming

Assignment Help:

Inbuilt Functions

i).  Functions to manipulate strings

The cstring library defines many functions to perform some manipulation operations with C-styled functions. The following are some of these functions:

  • strcat: char* strcat (char* dest, const char* src); Appends src string at the end of dest string.
    Returns dest.
  • strcmp: int strcmp (const char* string1, const char* string2); Compares strings string1 and
    string2. Returns 0 is both strings are equal.
  • strcpy: char* strcpy (char* dest, const char* src); Copies the content of src to dest. Returns dest.
  • strlen: size_t strlen (const char* string); Returns the length of string.

ii). Converting strings to other types

Due to that a string may contain representations of other data types like numbers it might be useful to translate that content to a variable of a numeric type. The cstdlib library provides three useful functions for this purpose:

  • atoi: converts string to int type.
  • atol: converts string to long type.
  • atof: converts string to float type.

All of these functions accept one parameter and return a value of the requested type (int, long or float).  


Related Discussions:- Inbuilt functions in cpp

Last ant on rod, You are given a collection of words, say as in a dictionar...

You are given a collection of words, say as in a dictionary. You can represent it in the following compressed form: the first word will be followed by a sequence of a pair of numbe

LOOP, DIFFERENCE BETWEEN WHILE AND DO WHILE LOOP?

DIFFERENCE BETWEEN WHILE AND DO WHILE LOOP?

Explain looping statements, Looping Statements The statements usually u...

Looping Statements The statements usually used for looping are for, do-while, while. The goto statement can be used for looping, but its use is generally avoided as it leads to

C program to demonstrate pointer to string, C program to demonstrate Pointe...

C program to demonstrate Pointer to string: void main() {                 int a;                 char str[]="hello how are you?",*ptr_str;                 ptr_str=&

Wap to calculate total marks and percentage of 3 subjects, WAP TO ACCEPT MA...

WAP TO ACCEPT MARKS OF THREE SUBJECT FOR STUDENT & CALCULATE TOTAL MARKS AND PERCENTAGE #include stdio.h> #include conio.h>   void main() {            int M1,M

Sdsds, Given an integer n and a permutation of numbers 1, 2 ... , n-1, n wr...

Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given

Algorithm, Write a algorithm to explain the processof wakingbup in morning

Write a algorithm to explain the processof wakingbup in morning

Areaundercurve, Write a program to find the area under the curve y = f(x) b...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw .

Define the assignment operators in c language, Define the Assignment Operat...

Define the Assignment Operators in c language? The assignment operators can be used to assign a value to the variable and is represented by equal to (=) sign. The Assignment ex

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd