Inbuilt functions in cpp, C/C++ Programming

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).  

Posted Date: 8/21/2012 11:53:26 AM | Location : United States

Related Discussions:- Inbuilt functions in cpp, Assignment Help, Ask Question on Inbuilt functions in cpp, Get Answer, Expert's Help, Inbuilt functions in cpp Discussions

Write discussion on Inbuilt functions in cpp
Your posts are moderated
Related Questions

Damjibhai and Shamjibhai are two jeweler friends. They decide to play a simple game. The game comprises of removing the jewels for polishing, turn by turn. Once a jewel is removed

payment system, in c++ only..just use the printf or scanf.please

claculate 5% tax >10000 sal

C Programming and Data Structures 1. Define and explain flow chart with an example. 2. Write an algorithm to print all even numbers in descending order and draw the flowcha

Write a function to calculate the exchange rate of pounds to dollars  Answer       Td = 2xTp   The parameter passed over is the number of pounds and returned the value in do

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

Write a ‘C’ program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

C++ Programming Assignment ATM Machine Phase 1 In this assignment you will create a program that allows a user to do the following: 1) Create a bank account by supplying a use