Problem: How to Measure the execution time of code or function speed in C++? Language: C++ [CPP] Solution: Use C++ clock() function to calculate elapsed time of code or function call How to use clock() function to measure elapsed time? Below example code is to calculate total elapsed time to execute an empty loop for […]
Category: C plus plus Tutorials
This article provides C plus plus source code to print character using ASCII value. It gets the ASCII value input from user and prints the corresponding character. C++ Source code to print character from ASCII value #include <iostream> using namespace std; int main() { int asciiValue; //Input the ASCII value cout << “Enter ASCII value: […]
Below is the source code to print ASCII value of a character entered by the user. CPP source code to print a character’s ASCII value #include <iostream> using namespace std; int main() { char character; //Input the character cout << “Type a character and hit ENTER: “; // Read the character cin >> character; // […]
Below is the C plus plus source code to remove special characters other than alphabets (excluding upper and lower case letters). // C++ source code to remove special characters other than alphabets from a string #include <iostream> using namespace std; int main() { string str; cout << “Enter a string with special characters: “; // […]
This article shows the C plus plus (C++) code to extract/replace a sub-string between two delimiters or characters using find and substr functions. Extract String between two delimiters For example, if you want to extract the string between two delimiters “[” and “]” from Sri[nivas]an , then the CPP code will be #include <iostream> using […]
C++ function to copy a file to another. Explained with it’s syntax, parameters, return value and an example Syntax Syntax of C++ function to copy file is BOOL CopyFile(LPCTSTR ExistingFileName, LPCTSTR NewFileName, BOOL bFailIfExists); Parameters ExistingFileNameEnter the existing file path which is to be copied NewFileNameEnter the new file path. This is the file where […]