2,322 Reusable Code Snippet Topics
Remove Filter ![]() | |
[B][I]{-='PLs DrOp sUm cOmMeNT gUy'z...=-}[/I][/B] | |
This is a quick and dirty example of a hex dump utility. Not much in the way of special features -- it just dumps the contents of a hard-coded filename in hex and also shows the characters. An example that can show the basics of making your own. | |
This program can solve expressions of the following forms: [ICODE]a+b[/ICODE],[ICODE]a-b[/ICODE],[ICODE]a*b[/ICODE],[ICODE]a/b[/ICODE] ([ICODE]a[/ICODE] and [ICODE]b[/ICODE] are numbers :P) Notice: You can't put spaces in between the operands and the operator, I know this is a limitation and that there are thousands of other ways to achieve a better result, so please don't … | |
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. | |
A game... Depends fully on luck that u have and a little bit of smartness.. You will be given 3 chances.. and 3 nos will me running randomly. u have to click when all t three no are same.. if u succeed in this then u are t winner.. Smart … | |
This is very very simple c code.. it has simple maths logic involved.. | |
The program is exactly to work out with maths fun.. u think of a two digit no.. say 24 now add both the digits i.e;2+4=6. subtract 6 with the no tat u thought originally.. i.e;24-6=18.. see t symbol which correspond to the no 18 and then press enter to see … | |
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 program consists of a function in one class. It demonstrates the "Left To Right" Principle used by most of the languages. | |
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. | |
This program take user name and password from the use but the password not display on screen insted of password ***** display Program by Meghdoot(meghs) | |
A simple C++ console calculator that uses square roots as well. | |
I want to show a simple example about writing record to a file,and for checking,read back from that file. Created By FlamingClaw | |
![]() | this is code that thanks to vegaseat helped me convert my programs into python30 |
"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. |
This algorithm will add the searched element's place in an array This works only when there is so element what we're searching for. By FlamingClaw | |
This algorithm will decide that is there a serched element in the array.If it finds one then the loop halts.If the loop halts cause we're stepping over the last element of the array then there is not searched element. By FlamingClaw | |
Counts that how many propertied elements are in the array example:negative numbers By FlamingClaw | |
The Rule: s:=0; Loop i:=1 To N s:=s+T[i]; End of Loop; Out:s; By FlamingClaw | |
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 ... … | |
Prime or not?This little program will show prime numbers with green color from 0 to 100.By FlamingClaw; | |
Although the DateTime structure in .NET has an IsLeapYear method. Lots of people in here like to do this on their own. See this snippet on how it can be done. This is in C# but other language adepts might benefit from it also. | |
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, … | |
A quick way of spying inside of a process. You could also turn this into something like a disassemble, pretty easy, if you wanted too. Quick Notes: The inline assembly is GCC dependent(quick fix for other compilers), and in MinGW you need to link th32 and gid32. The code flow … | |
Hello there, I've written a C++ function 'stod', which converts a C++ string to a double ... You're free to use this code for EVERYTHING you want ... There's only one thing which I'm not appreciating: [B][COLOR="Red"]It's not allowed to sell this source code to anyone ![/COLOR][/B] The usage is … | |
Well , i have created a simple chatting interface . i would not call it a chatting interface actually cuz i had something else in my mind and finally landed on something else . i would like if you guys could excecute it and help me making it a real … | |
This is a simple program and all it does is fiddle with the registry and set the value of the desktop background to be the bmp file that you supply in the function. There are other things you can do with the windows registry, this is just one of the … | |
Just a little snippet to check if a string contains only letters. | |
ADODB.Field error '80020009' Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. /nirmal/asp/editrecord.asp, line 0 | |
| |
Here's some rudimentary code that does directory traversal recursively. Useful for inspecting the contents of a directory subtree. Sorting the directory information or inspecting file details within directories is beyond the scope of this routine. | |
I want to show you some rules about bit operating like Not,And,Or,Xor,Shl,Shr... By FlamingClaw | |
This code snipplet will find the placement of each letter in a array(string), from another array(character set). For example: the input would be something like this: string[256] = "gfdc" chrset[256] = "abcdefg" and the output would be: num[256] = 6, 5, 2 and 3 | |
I've seen,there are guys that did not know,where to use a unit... See it just reference By FlamingClaw | |
This code snippets shows how to reverse a string using a stack. | |
This little program a solution for putting a string into an array. The method is that the string is divided for chars.... By FlamingClaw | |
This little calculator can +,-,/,*.Very simple,by FlamingClaw | |
We change the order of elements of a vektor Created by FlamingClaw | |
Often there is a case when we want to fill an array with record,and this program will demonstrate it... | |
|
The End.