- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7346 Articles for C++
1K+ Views
strncmp()The function strncmp() is used to compare left string to right string up to a number. It works same as strcmp(). It returns a value greater than zero when the matching character of left string has greater ASCII value than the character of the right string. Returns a value less than zero when the matching character of left string has lesser ASCII value than the character of the right string.Here is the syntax of strncmp() in C language, int strncmp ( const char *leftString, const char *rightString, size_t number );Here, leftString − The first string which is to be compared ... Read More
20K+ Views
The scope resolution operator ( :: ) is used for several reasons. For example: If the global variable name is same as local variable name, the scope resolution operator will be used to call the global variable. It is also used to define a function outside the class and used to access the static variables of class.Here an example of scope resolution operator in C++ language,Example Live Demo#include using namespace std; char a = 'm'; static int b = 50; int main() { char a = 's'; cout
163 Views
There are several methods to convert a single character to a string. In the following example, some of them are used to convert a character to a string.Here is an example of converting a single character to string in C++ language,Example Live Demo#include #include #include int main() { char c = 'm'; std::string s(1, c); std::cout
46 Views
The function remquo() is used to calculate the floating point remainder of numerator or denominator and stores the quotient to the passed pointer. It returns Nan(Not a number) when denominator is zero.Here is the syntax of remquo() in C++ language, float remquo(float var1, float var2, int* var3);Here, var1 − The variable which stores the value of numerator.var2 − The variable which stores the value of denominator.var3 − The pointer variable which stores the quotient.Here is an example of remquo() in C++ language, Example Live Demo#include #include using namespace std; int main() { float x = 28.8; ... Read More
73 Views
The function ldexp() is used to calculate the multiplication of a floating point value ‘a’ by the number 2 raised to the exponent power. It takes two arguments, first is a floating point number and second is an integer value.Here is the mathematical expression of ldexp(), ldexp() = a * 2^bHere is the syntax of ldexp() in C++ language, float ldexp(float variable1 , int variable2)Here, variable1 − Any name given to the variable which is representing the significand.variable2 − Any name given to the variable which is representing the exponent.Here is an example of ldexp() in C++ language, Example Live Demo#include ... Read More
36 Views
The function expm1() is used to calculate the exponential raised to the power of any number minus one. It returns the value of (exponential raised to the power of a) - 1.Here is the mathematical expression of expm1(),expm1(a) = (e^a) - 1Here is the syntax of expm1() in C++ language,float expm1(variable_name);Here,variable_name − Any name given to the variable whose value is calculated.Here is an example of expm1() in C++ language,Example Live Demo#include #include using namespace std; int main() { int x = 10; float y = 8.28; cout
72 Views
The function log1p() is used to calculate the natural logarithm (base e logarithm) of (a+1) where a is any number. It returns the value of natural logarithm of (a+1). It returns Not a number(Nan) when we pass a value which is less than -1.Here is the mathematical expression of log1p(), log1p(a) = base-e log(a+1)Here is the syntax of log1p() in C++ language, float log1p(float variable_name);Here, variable_name − Any name given to the variable whose logarithmic value is calculated.Here is an example of log1p() in C++ language, Example Live Demo#include #include using namespace std; int main() { int ... Read More
77 Views
The function frexp() is used to break the floating point number into its binary significand and integral exponent for 2. It returns the binary significand and its range is (0.5, 1). If we pass value zero, its significand and exponent value will be zero.Here is the mathematical expression of frexp(), x = significand * (2^exponent)Here is the syntax of frexp() in C++ language, float frexp(float variable_name, int* exponent);Here, variable_name − Any name of variable which has floating number to be decomposed into binary significant.exponent − It is a pointer to int where value of exponent is stored.Here is an example ... Read More
4K+ Views
Error handling is not supported by C language. There are some other ways by which error handling can be done in C language. The header file “error.h” is used to print the errors using return statement function.It returns -1 or NULL in case of any error and errno variable is set with the error code. Whenever a function is called in C language, errno variable is associated with it. errno is a global variable and is used to find the type of error in the execution.The following table displays some errors −Sr.NoErrors & Error value1I/O Error52No such file or directory23Argument ... Read More
208 Views
C++ is a middle-level language. It was developed by Bjarne Stroustrup in 1979. It is just an enhancement to C language and an object-oriented language. C# is modern and object-oriented language developed by Anders Hejlsberg. It is a part of the .NET framework. It is designed for Common Language Infrastructure (CLI). It is also a popular language. Difference between C++ and C# Both languages are object-oriented languages. C++ has low level of abstraction while C# has high level of abstraction. In C++, the program can be coded for any platform while in C#, the program is targeted towards windows ... Read More