Above program takes input of coefficient and power separately of 2 different polynomials add them up to a new polynomial.It is successfully compiled and executed in DEV CPP as C file.It Turbo C compiler add void before main function to avoid warning messages.

Member Avatar
Member Avatar
-1 forum 7

This snippet converts a CIDR notated IP address to a range of IP addresses in decimal, dotted notation. Eg.: 192.168.1.255/31 => 192.168.1.254 - 192.168.1.255

Member Avatar
Member Avatar
+0 forum 2

This Program implements the Predictive Parsing Of the grammar E->E+T/T F->F*T/F F->id(Identifier)

Member Avatar
Member Avatar
+0 forum 7

Hey everybody, Lately I have written the game Hangman in many different languages (C, JavaScript, Java and PHP so far). Here is the code snippet for C! It uses a words file, on the bottom of this post you will see a small example of a few words. You can adjust the default words file in the getWord() function (line 164). If the file does not exist, the script will ask for another words file. The words need to be separated by a |. Words files can be found can be found [URL="http://www.hangman.symbolwebdesign.nl/wordsfiles.php"]here[/URL]. ~G words.txt [CODE]abbey|abruptly|affix|askew|axiom|azure|bagpipes|bandwagon|banjo|bayou|bikini|blitz|bookworm|boxcar|boxful|buckaroo|buffalo|buffoon|cobweb|croquet|daiquiri|disavow|duplex|dwarves|equip|exodus[/CODE]

Member Avatar
Member Avatar
+0 forum 3

Hi all, here is a small program I have worked on over these last two days, I have submitted it in the hopes of some constructive criticism and suggestions (please be kind, this is one of my earlier C projects lol). This is a small console application that simulates a contact management database. The data that a user inputs is saved to an external dat file (contactdatabase.dat) which is created the first time a user saves and exits. This project also employs the use of Malloc(), which is used to allocate memory on the fly (at runtime) for dynamic data …

Member Avatar
Member Avatar
+1 forum 5

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
Member Avatar
+0 forum 3

Following is a matrix multiplication code written in MPI (Message Passing Interface) which could be run on CPU cluster for parallel processing. This has been successfully tested with two square matrices, each of the size 1500*1500.

Member Avatar
Member Avatar
+2 forum 5

A simple graphical year calendar. Compiler: Turbo C In main current year is set manually, for more generic way use date function to get current year.

Member Avatar
Member Avatar
+0 forum 4

[CODE]struct PCB* handleProcessArrival_PP(struct PCB *processhead,struct PCB *processtail,struct PCB *currProcess,struct PCB *newProcess,int currTime){ if(currProcess==NULL){ newProcess->executionStartTime = currTime; newProcess->executionEndTime = currTime+newProcess->totalBurstTime; newProcess->remainingBurstTime = newProcess->totalBurstTime; if(newProcess->processID==processhead->processID){ processhead= newProcess->next; printf("processhead in case 1 %d \n",processhead->processID); } currProcess=newProcess; printf("***current process = new process%d \n",currProcess->processID); contents(processhead); return currProcess; //return processhead; } if (currProcess->processID !=0){ contents(processhead); if(currProcess->processPriority>newProcess->processPriority){//new process higher priority printf("***new process in handle %d \n",newProcess->processID); currProcess->executionStartTime = 0; currProcess->executionEndTime = 0; currProcess->remainingBurstTime = currProcess->totalBurstTime-(currProcess->executionStartTime-currTime); processtail->next=currProcess; processtail=currProcess; newProcess->executionStartTime=currTime; newProcess->executionEndTime = currTime+newProcess->totalBurstTime; newProcess->remainingBurstTime = newProcess->totalBurstTime; currProcess=newProcess; printf("current process replaced with%d \n",newProcess->processID); printf("processhead in case 2 %d \n",processhead->processID); return currProcess; } if(currProcess->processPriority<newProcess->processPriority){//new process lower priority contents(processhead); newProcess->executionStartTime = 0; …

Member Avatar
Member Avatar
-1 forum 1

Many times [inlinecode]strtok[/inlinecode] is recommended for parsing a string; I don't care for [inlinecode]strtok[/inlinecode]. Why? [list][*]It modifies the incoming string, so it cannot be used with string literals or other constant strings. [*]The identity of the delimiting character is lost. [*]It uses a static buffer while parsing, so it's not reentrant. [*]It does not correctly handle "empty" fields -- that is, where two delimiters are back-to-back and meant to denote the lack of information in that field.[/list]This snippet shows a way to use [inlinecode]sscanf[/inlinecode] to parse a string into fields delimited by a character (a semicolon in this case, but …

Member Avatar
Member Avatar
+0 forum 7

Login functionality in C-language : Here the user enters the user id and password. The entered user id and password will be compared with the stored ones and user will be authenticated. While user enters password, characters should not be displayed on the screen. user id comparison must be case insensitive and password must be case sensitive.

Member Avatar
Member Avatar
+0 forum 6

The bubble sort is slow and I thought it would be interesting to visualize the progress as it sorts an array of integers.

Member Avatar
Member Avatar
+5 forum 11

too many new and intermediate users of C attempt to use the command [icode]fflush(stdin)[/icode] to "flush the input buffer". this is patently wrong. the rule is (and click if you don't believe me) : [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351"]NEVER [/URL][URL="http://answers.yahoo.com/question/index?qid=20071013052534AAuxWmW"]USE [/URL][URL="http://www.gidnetwork.com/b-57.html"]"FFLUSH()"[/URL] [URL="http://www.linuxforums.org/forum/linux-programming-scripting/41287-problem-fflush-stdin-function.html"]ON [/URL][URL="http://www.it.usyd.edu.au/~dasymond/mirror/c-faq/stdio/gets_flush2.html"]INPUT [/URL][URL="http://www.cplusplus.com/forum/general/6554/"]STREAMS [/URL][URL="http://c-faq.com/stdio/stdinflush.html"]SUCH [/URL][URL="http://gcc.gnu.org/ml/gcc-help/2009-01/msg00287.html"]AS [/URL][URL="http://www.dreamincode.net/forums/showtopic45833.htm"]"STDIN" [/URL] here is one method of properly flushing extra (and unwanted) characters from the stdin input stream. the code is written as a macro, and requires a character array to collect excess (junk) input. the macro will also ensure the newline character is stripped. the intended use is in conjunction with fgets. for example: [code=c] char userInput[8]; …

Member Avatar
Member Avatar
+0 forum 7

I have joined the thousands who have done it before, and have compared a number of sorting routines. The sorting is done on the same random-integer arrays. No surprises, quicksort wins this simple comparison hands down. There are clever combinations of sorting routines that are faster, like the snippet by Narue shown in: [url]http://www.daniweb.com/code/snippet61.html[/url] There is also an expert treatise on sorting at: [url]http://www.eternallyconfuzzled.com/tuts/sorting.html[/url]

Member Avatar
Member Avatar
+2 forum 2

it is a simple program but the beuty lies in its shortness it is written in least line as possible By :- Anurag Pareek

Member Avatar
Member Avatar
+0 forum 2

This will convert a decimal number into Gray code .

Member Avatar
Member Avatar
+1 forum 5

This is just a little example of howto make a Gtk+ application go fullscreen. This is really useful in game programming. Please rate/comment/report errors :icon_mrgreen:

Member Avatar
Member Avatar
+0 forum 1

Often times it is useful to instrument a program you do not have the source to in an attempt to learn more about it. This can be for debugging purposes, blackbox testing, or for providing alternate versions of common functions/libraries (to name a few). On Linux, there is a very useful feature for doing just this: `LD_PRELOAD`. In this post I will cover how to build a shim library for an alternate version of `malloc`. This is not an uncommon approach (`valgrind` originally did this) and can be a useful trick to have in your toolbox. In general (and very …

Member Avatar
+2 forum 0

Hi, I am just playing with C code in the console under Linux. In the old times a fair bit of code was written for a console; programs were operating in text mode, creating menues was quite a fun. I coded very simple c routine to print a strings of characters on the console but the characters, each is in its own single box and the whole set of strings is in a large complette box. I thought it could be intersting for someone to use it as an excersise. This is nothing complex as for the 'C' code. :-) …

Member Avatar
Member Avatar
+1 forum 3

This code allows you to create a linked list and reverse it recursively.

Member Avatar
Member Avatar
+0 forum 10

A simple program to show you how to create a table of Fahrenheit and Celsius values using a for loop. You may be able to learn from this code.

Member Avatar
Member Avatar
+1 forum 2

This Program prints the numbers in given array(Row-Major Order) in Spiral order. Ex: Order Is 3*4 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Spiral Order Of Matrix is 11 12 13 14 18 22 26 25 24 23 19 15 16 17 21 20

Member Avatar
Member Avatar
+0 forum 3

The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y. Write a recursive method Gcd that returns the greatest common divisor of x and y. The Gcd of x and y is defined recursively as follows: If y is equal to 0, then Gcd( x, y ) is x; otherwise, Gcd( x, y ) is Gcd( y, x % y ), where % is the modulus operator. Could you help me with it (I feel it is very wrong).

Member Avatar
Member Avatar
+0 forum 3

One of the things which attracted my attention was that there are often newbies asking how to create a password program in C/C++, often they don't succeed, well here's my response, you can use it for any purpose you want, one thing you'll have to keep in mind is that this code will only work on compilers which support conio.h, I know that it's actually a bad habit to make use of this "library", but most of the newbies which are searching for code like this are always using a compiler which supports it, so I guess that won't be …

Member Avatar
Member Avatar
+0 forum 25

A complete C implementation of Linked List...tested on Linux GCC

Member Avatar
Member Avatar
+0 forum 5

This is an example of a singly linked list allowing you to enter a number of names and associated ages. The twist is that the names are inserted into the list in ascending order. When the list is displayed, it is already sorted by name. Note: This is not an exercise in safe data input. While precautions have been taken, any fool can stress the language easily.

Member Avatar
Member Avatar
+1 forum 7

this is a small graphical program in c....which gives you a clear discription about what a graphics can do in c..(a simple one)

Member Avatar
Member Avatar
+0 forum 2

Similar to echoserver, but this one handles multiple clients by forking the process.

Member Avatar
+0 forum 0

This is a simple echo server that I've written while learning sockets programming. Compile the server and run it. You can connect to it using telnet like this: telnet localhost 1337 Disconnect the client by typing "/quit" without quotes.

Member Avatar
+0 forum 0

Here is a simple implementation of implementing a simple Left trim (ltrim) and Right trim(rtim) of unwanted characters from a C style string. (null terminated strings). Doesn't suffer the overheads of the memmove implementation in which the worst case scenario (a string containing all junk characters) is approx. N^2 / 2. Comments, constructive criticisims are welcome.

Member Avatar
Member Avatar
+0 forum 12

The End.