Server Side Programming Articles - Page 2384 of 2646

Python program for removing n-th character from a string?

Akshitha Mote
Updated on 23-Jun-2025 19:30:06

1K+ Views

The problem statement is to remove the nth character from the given string. Let's understand with an example. Consider my_string = "Tutorialspoint". The given value of n is 6; then we need to remove the 5th character from the string. Because the index value starts from zero. And it should result in "Tutorialspoint". Removing nth Character using a for Loop The for loop can be used to remove the n-th character from a string. In this approach, we iterate through each index of the string and print the characters. If the index value is equal to the given (n-1)th value, we ... Read More

New Features of C++17

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

686 Views

C++17 is the latest version of standard C++ language. C++11 and C++14 are the previous versions of C++. The current version makes several additions to the core language while some previous features are also removed. C++17 is known as feature full or feature complete. There are some of the new changes introduced in C++17 − Library changes - utils This is one of the most amazing feature of C++17. It merges the features and patterns of other libraries. Many of the sub-libraries are merged together into standards. The following features are added to utils library in C++17 − std::variant ... Read More

Difference between strncmp() and strcmp() in C/C++

George John
Updated on 14-Apr-2025 19:16:27

2K+ Views

Both strncmp() and strcmp() are used in C/C++ programs for lexicographical string comparison. The strcmp() compares two strings till the null character is found, whereas strncmp() only compares a specified number of characters. What is 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 ... Read More

How to convert a single character to string in C++?

Tapas Kumar Ghosh
Updated on 05-May-2025 18:36:35

402 Views

In C++, a single character is represented using a single quotation (' ') while a string is represented using a double quotation (" "). To change the single character into a string, use approaches like string_constructor, push_back(), etc., that solve the conversion. Example Input: ch = 'A' Output: str = A // "A" So, character A is converted to a string. C++ provides various approaches to convert single character into string as follows: Using string constructor Using push_back() Using stringstream ... Read More

remquo() in C++

Ankith Reddy
Updated on 25-Jun-2020 10:09:57

92 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

ldexp() in C++

George John
Updated on 25-Jun-2020 10:10:32

115 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

expm1() in C++

Chandu yadav
Updated on 25-Jun-2020 10:11:08

81 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

log1p() in C++

Arjun Thakur
Updated on 25-Jun-2020 10:11:47

135 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

frexp() in C++

Ankith Reddy
Updated on 25-Jun-2020 10:12:32

148 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

Which is faster between C++ and C#?

Chandu yadav
Updated on 30-Jul-2019 22:30:23

305 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

Advertisements