49,761 Topics
| |
Heres a snippet that compares the speed of volatile (nonregister) variables, and register variables and display's the average cycle count for each. This shows you exactly how much using registers speeds up loops and calculations. I get the following output, but it may vary: [QUOTE]Cycle count for nonregister integer: 8 … | |
CPU Performance Counter based clock and stop-watch classes for Win2K++ were implemented in VC++. Details: see sources (I hope, these classes, especially StopWatch, have well-to-do interfaces;)). Warning: no special precautions for multi-threading/multi-core CPU environment. It's not so hard work to translate these codes in C (or other C++ implementations). This … | |
this is the other part of my 2nd semester, first quarter project for programming 2. a simple function to convert from arabic numbers to roman numbers. | |
This code was part of my first quarter 2nd semester project for a subject called programming 2. its a simple roman to arabic convertion function. | |
This code is an example of a simple bubble sort function in C++. the function doesnt receive or returns nothing just for the record, some translations "declaracion de constante" = constant declaration "prototipo de funcion" = function prototype "arreglo" = array "Arreglo en el orden original" = original array order … | |
| Well technically it isn't an anagram finder, more of a word descrambler program. It is useful for games like scrabble etc. All you need is a dictionary file, which you can find readily online. Make sure the file has the words on each line and they are all in lowercase. … |
Nothing too special, but it was an interesting task. | |
This simple command line script is used to pull a prank on one of your buds. What it does is play an anoyying beeping sound over and over again while rendering the computer being used completely unresponsive. The task manager doesnt even respond. The window never loses focus and nothing … | |
Put the following code in a C++ Header File. The following function is to make it way more easier to draw text onto the client area of a window. Now the only thing you need to do is include the C++ Header file containing this function into any C++ Source … | |
This snippet shows how to use hooks to stop the cursor from entering a certain area of the screen. This example will stop the cursor from going over 300 pixels away from the centre of the screen by using a bit of maths. | |
| How to sort a class by their various attributes in C++ |
This is a program I designed that implements a little bit of vector-math to determine the collision between 2 vectors. Hopefully this program will be useful to those out there designing 2D graphics programs and need a better solution to determining graphical object-to-object collisions when two objects meet, without having … | |
Hey, Here is a program I made which has interested quite a lot of people over the past few weeks, so I figured I would share it :) Using a small amount of trigonometry you can create some very fascinating shapes and effects. But in order to draw anything you … | |
One problem with C# is that if you want to modify a collection, you have to manually iterate over it. The generic List class supports ForEach, but there's no method that allows global list changes. C# is kind of restrictive in what changes you can make while iterating, so Edward … | |
Edward designed this class as a poor man's named property initializer using syntax similar to C99's designated initializers if they worked in a C++ constructor call: [code] Person me( .FirstName="Radical", .LastName="Edward", .Age=23 ); [/code] | |
The code prompts the user for a student name and the marks then prints out the report with a letter grade..It also asks the user for the file name and stores the data in the file. | |
Just playing with the no. points used in the program: 1. Even no cannot be prime except 2 2. % division of odd by even cannot be 0 | |
Just playing with the no. points used in the program: 1. Even no cannot be prime except 2 2. % division of odd by even cannot be 0 | |
Good day, here is one of the commands that will allow you to get sound in your program. It was compiled using DevC++. | |
Nothing but the VERY HARD Work out for long day and night. It was actually i made it for my project work which my friend loved it very much. This might be the useful stuff to you also. Ya Now days rarely anyone uses the BGI stuff but also it … | |
This program generates lines of pascal's triangle, numbers after 23 generate weird output. | |
This program takes a parameter, which is how many prime numbers you need. However if you want to make a program which checks whether a number is prime or not you can delete everything in the main function and put this line instead: cout << isPrime (argv [1]) ? "It's … | |
Two methods for two distinct needs when splitting a string | |
This program uses snipets from a couple of other programs that I put together in order to make a program that displays the time and date and refreshes the time and date every second. I commented practically every line to explain, as far as I know, what it does. If … | |
Frequently, you may need to isolate words in a phrase. In this example, we'll use substr to carry out this task. | |
This is a neat little program to calculate the date of easter in any given year. The principle is based on the julian calendar. | |
First off, C++ does not know anything about the I/O device you are using. It can be a keyboard and monitor, or a file, or a network connection, or anything which can do I/O. What that means is that there is no standard way to do this in C++. That … | |
This is a simple example of how to delete a line from a text file. In order to do that you have to completely rewrite the file, leaving out the line(s) you want to delete. First open the input file, then open an output file (doesn't matter what filename you … | |
hello frnds this is a snippet that removes comments of c, c++ , java files | |
This snippet will allow you to separate or "explode" strings into vectors via a character separator or the visa versa. In which case you would take a vector and "implode" it into a string separated by a character. Also keep in mind that this requires the libboost libraries. This was … |
The End.