344 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for vegaseat

Things don't have to be black and white all the time. Use a Windows API call to add some color to your text output.

Member Avatar for Dani
2
73K
Member Avatar for Kate_12

Can someone please give me tips on how to accomplish generating a random number within a random range. See 'roll_dice' #include <iostream> #include <limits> #include <ctime> #include <iomanip> #include <cstdlib> using namespace std; using std::cout; using std::cin; struct Sanity { unsigned int turns = std::numeric_limits<int>::max(); unsigned int sanity = std::numeric_limits<int>::max(); …

Member Avatar for Schol-R-LEA
0
270
Member Avatar for jnbgames.dev

The program below is written in **C** and is used to convert numbers to words. These operations are beneficial during the development of word processing applications. The program takes the **input** file that contains the number and **outputs** the results in an output file. Let me know if you find …

Member Avatar for Dani
0
451
Member Avatar for jnbgames.dev

The program below is written in **C** and is used to create a **learning management system**. This program is beneficial during the development of an **e-learning** desktop application. Let me know if you find the code below helpful and if you have any additional suggestions:

Member Avatar for Dani
1
441
Member Avatar for jnbgames.dev

The program below is written in C and creates a stack that holds the values of a maze. This structure is beneficial during the development of a desktop game that uses a maze. Let me know if you find the code below helpful and if you have any additional suggestions:

Member Avatar for Dani
1
322
Member Avatar for jnbgames.dev

The program below is written in C and is used to perform fast number operations. These operations are beneficial during the development of spreadsheet applications. Let me know if you find the code below helpful and if you have any additional suggestions:

Member Avatar for rproffitt
0
236
Member Avatar for rajesanthu

[B][COLOR="Red"]Simple C++ program for age calculation[/COLOR][/B] [COLOR="Green"][B]NB:Excuse me experts,,this is only for beginners.........[/B][/COLOR] Instructions//// 1.Copy the code 2.paste it in a text file 3.save the text file as agecalc.cpp and select file type all with in the text file. 4.paste this file inside your bin folder where the Turbo C …

Member Avatar for Youssef Faisal
-4
44K
Member Avatar for thomasdoejr

Write a program using for loops to produce an R by C rectangle, where R and C are provided by the user. The following are the triangles for different values of R and C. R is the number of rows and C is the number of columns

Member Avatar for rproffitt
0
338
Member Avatar for vegaseat

What "Hello World" is to the console, the "Bouncing Ball" is to the Graphical User Interface. Nothing fancy, the ball is created via a call to the API function ellipse() and then bounced within the confines of the windows form. For the DEV C++ crowd: Let me know if you …

Member Avatar for laheg
2
25K
Member Avatar for Abdul_68

Q1. Given the partial implemenatation of Linked List, you are required to add the following functionality in the code Delete the whole list e.g. myList.deleteAll( ); Implement Linked Stack for Character data type and show how it reverses your Name. Q2. Show in diagramatic representation (draw by hand, take picture …

Member Avatar for rproffitt
-1
245
Member Avatar for tinstaafl

There are times when you need to make sure your counter starts at an odd or even number. Even is pretty simple - `counter = counter + modulus(counter)`. If counter is even it stays, if it's odd it gets incremented by 1. Odd is a bit more complicated - `counter …

Member Avatar for holisticgroup19
3
4K
Member Avatar for piyush gandhi
Member Avatar for KarmaHunter
-2
11K
Member Avatar for MosaicFuneral

Haven't programmed in a long time. Last project was a GCODE pathway generator I wrote several years back. My compiler is obviously several years out of date. Uses time(), itoa(), rand(). Current standard compliant compilers should have <chrono>, <thread>, <random>, and to_string() in suppliment to those more deprecated functions. This …

Member Avatar for DGPickett
2
3K
Member Avatar for Hamza_23

i want to write code in data structure using c++. my topic is online voting system.

Member Avatar for Adhocdegra
0
768
Member Avatar for restrictment
Member Avatar for emeraldamerican
0
6K
Member Avatar for vegaseat

The snippet shows how to create a menu on a windows form and test it. Original code via BCX, modified to compile with Dev C++ as a Windows Application. This approach does speed up writing of GUI programs.

Member Avatar for iman_1
1
5K
Member Avatar for Black Magic

Hey, i was just mucking around and improving my code etc and made a calculator, it's not the best calculator in the world, it only can handle 1 or 2 numbers but i think it's good my self :).

Member Avatar for Reverend Jim
0
5K
Member Avatar for NicAx64

Well inside the windows operating system there are predefinided dialog boxes. We can use it freely with little effort. Think that you have to get a input file name or file path. The traditional way of doing this is parsing the command line arguments.But here we are in win32 , …

Member Avatar for Y_2
0
19K
Member Avatar for Alex Edwards

This is a remake of the Simple Equation Solver snippet that is written in Java. This is an equivalent version written in C++.

Member Avatar for hassan_24
1
8K
Member Avatar for vegaseat

A little calculator written in BCX basic and then translated to C code and modified to compile with Dev C++ (GCC/G++). Once you find your way past the standard GUI gibberish you can figure it out. For those who need some hand holding with the Dev C++ IDE: In the …

Member Avatar for rproffitt
1
6K
Member Avatar for William Hemsworth
Member Avatar for Uchenna_1
0
9K
Member Avatar for Lp_baez

when the console displays the "StudentAns" I get weird characters instead of the actual answer. ///////////////////////////////////////////////////////////// this is the files CorrectAnswers.txt A D B C A A D B D C A D B A C C D B C A StudentAnswers.txt A D B C A A D B …

Member Avatar for AssertNull
0
349
Member Avatar for Gribouillis

This snippets contains a python program to find a shortest solution to the problem of the farmer who whishes to cross a river. The boat can only contain two things, including the rower. The farmer comes with a wolf, a duck and a bag of corn, and he can't leave …

Member Avatar for Gribouillis
0
2K
Member Avatar for directorabbey

void Halt (); void Reply (const char * num,uint8_t stat); { this is the error message for this code 7|error: 'uint8_t' has not been declared 9|error: expected unqualified-id before '{' token

Member Avatar for directorabbey
0
266
Member Avatar for vicky_dev

This program displays a simple analog clock to show the current system time. Uses a Hand class to create objects - hour, minute and seconds hands.The 'hands' are just straight lines, and two circles make the 'frame' of the clock. Compiles correctly on TurboC++ v3.0

Member Avatar for salman_7
0
2K
Member Avatar for Luckychap

This is a program for Encryption and Decryption This program uses the Simple Data Encryption Standard (SDES) Algorithm. This Algo takes 8-bits of plaintext at a time and produces 8-bits of ciphertext. It uses 10-bits of key for Encryption and Decryption.

Member Avatar for overwraith
1
13K
Member Avatar for William Hemsworth

Quite a while ago, I made [URL="http://www.daniweb.com/code/snippet217147.html"][B]this[/B][/URL] snippet. This code is basically the same, except that it adds animation. This method of blitting is very fast assuming you don't use a surface that's too large. On a 500 x 500 surface, I managed 350fps using only 0-1% of the cpu. …

Member Avatar for thetukiet
1
7K
Member Avatar for Dani

This is a program I just recently completed for a computer science course. Given a 2D grid, where every path between two gridpoints has a weight (path length) associated with it, this program computes the shortest path from (1,1) to (m,n). You are only allowed to move up and to …

Member Avatar for mohmedd
0
541
Member Avatar for justzamir

I am totaly new to C++, and i am trying to get sum of two digits, but i am getting some error, will somebody please correct my code. Regards

Member Avatar for jencas
1
337
Member Avatar for iamthwee

The End.