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
reocord of a student and a function ctotal to calculate the marks of any three subject by using ctotal() function

Described the order that objects in an array is destructed?

find the minimum total number of shelves

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Explain high-order and low-order bytes. - Numbers are written from left to right in decreasing order of significance. In the same way, bits in a byte of computer memory can be

Defines the entry point for the console application. // #include "stdafx.h" #include #include #include"conio.h" using namespace std; double Determinant(double a[][3],int forde

Develop a program to meet the following requirements: 1. Must use at least one function in addition to main (you can use more) 2. Must use selection 3. Must use deference/indire

create algorithm for doubly link list using c data structure

Project Description: Currently seeking someone who can create me a software application (google chrome crx file_ that will auto add all shoe sizes to cart directly and if not av

Objective Using C++ string, classes, constructors and member functions. Task A Write a program (book.cpp) to store a list of book titles and the published dates. Your pro