49,761 Topics
| |
Convert string to other datatypes via template. See below. | |
Random number generator under its own namespace. Its a sample program. | |
Link List for the beginners of cpp, who want to get the idea about link list before starting OOP. its implemented by struct for best teaching the design standards to beginners. | |
This is how I would write the standard library function [B]strstr[/B] if I had to implement it from scratch. | |
Example of how to get a random number in the range of six and return a value based upon it. Please Rate/Comment/Report Bugs | |
This is a portable implementation for converting a character or an integer to its binary text equivalent. It makes use of the [B]CHAR_BIT[/B] constant (which is defined in the header file [B]climits[/B]) to get the number of bits a byte consists of on the implementation where you compile this code … | |
I didn't know what to do and I thought: why not try writing an interpreter, I've never done this before and it seemed quite challenging, so I started writing code.... The code which you can find below is only a simple base upon which you can start implementing your own … | |
| |
This is the Dialogs.h part from the WGCL C++ Compiler Library I created. This creates classes for dialogs, it could cut the amount of code for dialogs you need to write in half, while still having the same amount of functionality. This library is licensed under the GNU General Public … | |
My implementation of the [ICODE]strcmp[/ICODE] and [ICODE]strncmp[/ICODE] functions. I don't think that it is very efficient, but have managed to get both the functions' execution times to [ICODE]0.01 s[/ICODE] (At least, this is the value my profiler gives me). Enjoy! :) | |
This snippet allows you to convert a text representation(*) of a [B]binary[/B] number [B]to[/B] a [B]decimal[/B] number :) (*): With 'text representation' I mean for example a string containing "1001" or "10001110011", etc. ... | |
These functions, to some, may seem trivial, but many people have queried in the forums on this topic numerous times. The functions are templated, so that it can accommodate any data-type that the user wishes to use (For example, the same function can be used for converting variables of type … | |
This is how mine [B]strcat[/B] would look like if I'd have to write it from scratch :) | |
This is how mine [B]strcpy[/B] would look like if I'd have to write it from scratch :) | |
This prime number generator is based on Eratosthenes' sieve, the found prime numbers are written to a file (you can specify it's name as a command line argument, as well you can specify the prime number upper bound (e.g: if you specify 500 as upper bound, the program will find … | |
This is not the fastest way and not the one that used inside the calculators and even inside the C++ math library. But this is just another way to find logrithm of base 10. | |
This snippet is similar to my snippets on how to create random numbers without repeats, particularly[URL="http://www.daniweb.com/code/snippet1034.html"] this one[/URL]. This snippet is different in that it takes an already existing array and "shuffles" it so that the order appears random. No checking is done to make sure that there are no … | |
Probably one of the poorest sorting algorithms ever written but I provide it here and anyone who wants to use it can use it in any way he/she wants :P ... Usage: `bubble_sort(your_array, number_of_elements);` int arr[] = {52,85,2,1,-56,802}; bubble_sort(arr, 6); /* order of elements in arr: {-56, 1, 2, 52, … | |
> I know there are some bad things in my code such as [ICODE]system("CLS");[/ICODE] and that this makes the code unportable and inefficient, but you could just remove it at anytime :) > It could be that my code is a bit bloated, I didn't put enough time and effort … | |
This snippet basically shows you how to input a password from the user without actually displaying the characters, instead they are replaced with the ' * ' character as you type. The code is uncommented, so I will briefly explain it. This function: [ICODE]void PasswordInput(char *password, size_t maxLength)[/ICODE] has two … | |
Snippet to show how to count the number of occurences of letters in a string. | |
A simple C++ console calculator that uses square roots as well. | |
"Hello World!" done a little differently. Is this safe, unlikely; is there a point to all of this crap, nope; why are parts obfuscated, because I felt like it; was it fun, yes. You'll need the newest version of MinGW to compile, I used options -O2 -Os -s. | |
Got bored, remember a question asked in the forums, and decided to try something similar. | |
Hi this basicly finds and stores prime numbers at you will need to put a file called startnumber.ini with a number in it for the program to start from. Also rename the UserStorage.txt each time you use the program or it will be overwriten. | |
| The given code snippet checks whether a given string is a part of other string and wildcard are allowed. |
Hello, as promised I updated my stod-function from [URL="http://www.daniweb.com/code/snippet1147.html"]this[/URL] thread ... Enjoy ! | |
Hi there, I've written a program which can add two numbers of unspecified length, isn't that nice? To add two numbers you just do the following: [ICODE]addition(number1, number2);[/ICODE], where 'number1' and 'number2' are strings ... E.g: [CODE=cplusplus] ... cout << addition("500","10") << endl; // Print '510' on the screen ... … | |
Hello, I've written a C++ class which 'estimates' the roots of a given number ... It was called 'sqr' because it was first intended to estimate square roots only, but later on I made some little changes to my code which made it possible to estimate every root ... So, … |
The End.