51,593 Topics

Member Avatar for
Member Avatar for tux4life

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 …

Member Avatar for tux4life
0
841
Member Avatar for rhoit
Member Avatar for wavsyntax
Member Avatar for killdude69

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 …

Member Avatar for killdude69
0
215
Member Avatar for amrith92

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! :)

Member Avatar for amrith92
0
620
Member Avatar for tux4life

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. ...

Member Avatar for tux4life
0
213
Member Avatar for amrith92

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 …

Member Avatar for tux4life
0
390
Member Avatar for tux4life

This is how mine [B]strcat[/B] would look like if I'd have to write it from scratch :)

Member Avatar for tux4life
0
387
Member Avatar for tux4life

This is how mine [B]strcpy[/B] would look like if I'd have to write it from scratch :)

Member Avatar for tux4life
0
210
Member Avatar for tux4life

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 …

0
184
Member Avatar for NicAx64

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.

Member Avatar for ddanbe
0
105
Member Avatar for VernonDozier

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 …

1
776
Member Avatar for tux4life

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, …

0
153
Member Avatar for tux4life

> 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 …

Member Avatar for tux4life
0
259
Member Avatar for William Hemsworth

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 …

0
525
Member Avatar for William Hemsworth
Member Avatar for William Hemsworth
0
744
Member Avatar for GANTOR
Member Avatar for Nick Evan
0
144
Member Avatar for MosaicFuneral

"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.

Member Avatar for MosaicFuneral
0
357
Member Avatar for MosaicFuneral

Got bored, remember a question asked in the forums, and decided to try something similar.

Member Avatar for MosaicFuneral
0
9K
Member Avatar for kelechi96

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.

Member Avatar for William Hemsworth
0
242
Member Avatar for GreenDay2001

The given code snippet checks whether a given string is a part of other string and wildcard are allowed.

0
115
Member Avatar for tux4life

Hello, as promised I updated my stod-function from [URL="http://www.daniweb.com/code/snippet1147.html"]this[/URL] thread ... Enjoy !

Member Avatar for tux4life
0
553
Member Avatar for tux4life

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 ... …

Member Avatar for tux4life
0
269
Member Avatar for tux4life

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, …

Member Avatar for tux4life
0
185
Member Avatar for MosaicFuneral

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 …

0
462
Member Avatar for tux4life

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 …

Member Avatar for tux4life
0
4K
Member Avatar for hastingo

// Displays a file in either upper- or // lowercase depending upon a user request. #include <fstream> #include <iostream> #include <string> #include <ctype.h> using namespace std; // Display(): display text stream using ToFunc // modification void Display(ifstream &fin, int (*ToFunc)(int c)) { // extract and display characters one-at-a-time char CurrentChar; …

0
105
Member Avatar for sahasrara
Member Avatar for Freaky_Chris

This is a sample code snippet of a quicksort that uses templating and function pointers to allow the user to sort an array of anything from numbers to strings to structures. The idea is, that the coder writes a small function thats return type is bool, It should return true …

0
227
Member Avatar for sahasrara

Hi friens Linear search is a way of finding an element in the array that we made it . Binary search is quicker than Linear search . in this code if key was found , it is removed from array and then sorted array is shown again. Good Luck!

0
146
Member Avatar for sahasrara

Dear all This code shows, look for an integer number in the array of this type that we used from Binary search. It was wrote by Borland 5.02 . Good Luck!

Member Avatar for ddanbe
0
120
Member Avatar for Freaky_Chris

This snippet can be used to convert from bases between 2 & 16 to base between 2 & 16. This is an extension on converting decimal to any base snippet found here: [url]http://www.daniweb.com/code/snippet1067.html[/url] (By no means is this the best method of doing this, but provides rather a nice way)

0
683
Member Avatar for kameshwar

Pascal's triangle is a geometric arrangement of the binomial coefficients in a triangle. The rows of Pascal's triangle are conventionally enumerated starting with row zero, and the numbers in odd rows are usually staggered relative to the numbers in even rows. A simple construction of the triangle proceeds in the …

0
147
Member Avatar for sahasrara

Dear entourage Here is a solution that read two matrix of complex numbers ( including imaginary an real ) and add and multiply these together. I wrote it by Borland 5.02 . Do joy !!!

0
2K
Member Avatar for sahasrara

Dear all This code first read a string then shows number of repetition of each character . I wrote it by Borland 5.02 . Good Luck !

Member Avatar for tux4life
0
136
Member Avatar for William Hemsworth

This snippet shows how you can manually split up a sentence using multiple delimiters. In this example, I split up this sentence: [ICODE]"Hello, my name is william!"[/ICODE] into the following: [ICODE]"Hello"[/ICODE] [ICODE]"my"[/ICODE] [ICODE]"name"[/ICODE] [ICODE]"is"[/ICODE] [ICODE]"william"[/ICODE] As you can see, the delimiters are not included ([ICODE]" ,!"[/ICODE])

Member Avatar for William Hemsworth
0
277
Member Avatar for sahasrara

Hi my friends In this part you can see a link list that sort when you add your number. First number set as the first node. next number that you will enter , is compare with first node. if it was less than first , it set as first . …

Member Avatar for sahasrara
0
163
Member Avatar for sahasrara

Dear all This program takes from you a alphabetic character and shows all of characters before it .(ascending or descending) I wrote it by Borland 5.02 . DO JOY!!!!

0
89
Member Avatar for sahasrara

Dear my friends This code take base of time details as second , minute and hour . it also take base of date details as day , month and year . Then it take length of time and date details . Finaly these information is process by program and it …

0
95
Member Avatar for sahasrara

This code converts decimal number to hexadecimal number I wrote it by Borland 5.02 . Good Luck

0
163
Member Avatar for sahasrara

Hi Hi Hi this solution is inverse of other solution that changed Decimal number to hexadecimal . It changes hexadecimal number to Decimal ! There is the other way to change characters to numbers. Good Luck!

Member Avatar for sahasrara
0
193
Member Avatar for sahasrara

Hi ladies and gentlemen This program is a sample of data structure for information of students . this data structure is Linked List that include public & private filds. Its private has the other class which i named it node. node builds physical structure of linklist class. node class consist …

0
175
Member Avatar for sahasrara

Dear programmer This program get 2 (simply) numbers in 10 radix , then changes them to 16 radix and add together and finally shows result. I wrote it by Borland 5.2 C++ . Good Luck!

0
141
Member Avatar for VernonDozier

I received some feedback on my [URL="http://www.daniweb.com/code/snippet1019.html"]earlier code snippet[/URL] regarding how to generate unique random numbers and someone suggested I make a shorter, easier example, so here it is. This example simply generates the integers from 0 to 9 in random order without any repeats. It is basically the function …

0
749
Member Avatar for MosaicFuneral

After flipping through some organic chemistry books I had, I found a interesting little table of basic hydrocarbons. I decided it would be nice to play around with it, by putting together something that could to some accuracy generate them. I am by no means a chemist. You don't even …

0
142
Member Avatar for MosaicFuneral

I decided to find a use for the STL map, and this is what I decided would be cool to practice with. Just have three placed in the code. Could use a function to load the requested elements from a file.

Member Avatar for ddanbe
0
253
Member Avatar for VernonDozier

Very often you find that you need to generate an array of integers where each integer is unique. The program below contains two functions that do that in different ways. One uses a boolean array to keep track of the numbers that have been generated. If a number has already …

Member Avatar for VernonDozier
0
508
Member Avatar for MosaicFuneral

From part of a cryptanalysis tool I was writing, the other day. A way of obtaining possible XOR'ed string values. If you ever get to the point in the analysis that you can simply XOR the string to get closer towards your goal, of finding a weakness, this might be …

Member Avatar for MosaicFuneral
0
379
Member Avatar for MosaicFuneral

Occasionally there's times when you want to shift a bit over, but you would like to preserve the end of it, for one reason or another. Such as with say you have: [icode]10000001[/icode] but you would like: [icode]00000011[/icode] then latter on back to: [icode]10000001[/icode] Or in Dec 129-into-3, and 3-into-129. …

0
1K
Member Avatar for Alex Edwards

Provides a means of performing operations on Rational numbers that can be treated as fractions to make non-whole numbers easier to calculate and read than typical floating point storage types. This was a project for a class. This is by no means an attempt to "reinvent the wheel" (The reason …

Member Avatar for MosaicFuneral
0
898

The End.