Forum: C Oct 4th, 2009 |
| Replies: 3 Views: 225 Take a good look at:
http://www.daniweb.com/tutorials/tutorial45806.html |
Forum: C Oct 4th, 2009 |
| Replies: 8 Views: 67,345 Ah, thanks the explanation by Narue explains it all in detail. Thanks again! |
Forum: C Oct 4th, 2009 |
| Replies: 8 Views: 67,345 What is missing here is an example of a text entry followed by a numeric entry. I tried to combine the code presented and should the text exceed its length of 19 and have numbers at the end, ouch! |
Forum: C Oct 3rd, 2009 |
| Replies: 11 Views: 650 Okay, I got the message, I will post more stuff in the every so lively C forum!!!! |
Forum: C Oct 1st, 2009 |
| Replies: 11 Views: 650 In Python it would be very simple, the url string for the search being the most complicated part ...
# search google with the default web browser (new tab)
# tested with Python 3.1.1
import... |
Forum: C Oct 1st, 2009 |
| Replies: 11 Views: 650 Most people call it HTML Scraping. The programs are called HTML Scrapers. Easy to do with Python, don't know about C. |
Forum: C Jun 27th, 2007 |
| Replies: 3 Views: 905 A couple of excellent code snippets by Dave Sinkula on this very subject:
Read an Integer from the User, Part 1
http://www.daniweb.com/code/snippet266.html
Read a Line of Text from the User ... |
Forum: C Jun 22nd, 2007 |
| Replies: 18 Views: 56,552 This thread is 3 years old, so it might have been read that many times! |
Forum: C Jun 20th, 2007 |
| Replies: 18 Views: 56,552 Somewhere in the C compiler details it states that the code has to finish with a newline. Dev-Cpp's GNU compiler and some other compilers give a warning, not an error. Many IDEs put the new line in... |
Forum: C Jun 15th, 2007 |
| Replies: 0 Views: 5,234 I borrowed this from C#, where you can easily send output, that normally goes to the ugly black console window, to a nice looking Windows MessageBox with an OK button to close after you read your... |
Forum: C Jun 15th, 2007 |
| Replies: 5 Views: 1,326 Not better, but cute, create your own display window with a Windows message box ...
// use a message box to display console output
// compile as GUI
#include <windows.h>
#include <string.h>... |
Forum: C Jun 4th, 2007 |
| Replies: 4 Views: 6,624 Take a look at the code snippet at:
http://www.daniweb.com/code/snippet66.html |
Forum: C Jun 1st, 2007 |
| Replies: 27 Views: 4,634 Dave Sinkula, a very talented C programmer, has given quite a bit of attention to this issue. Take a look at one or more of his code snippets at DaniWeb:
http://www.daniweb.com/code/snippet266.html |
Forum: C Feb 9th, 2007 |
| Replies: 18 Views: 4,843 Only the world renowned modesty practiced by the inhabitants of the state of Minnesota must have prevented Dave from mentioning his many excellent articles on this very subject ...... |
Forum: C Nov 20th, 2006 |
| Replies: 34 Views: 5,908 Sin-da-cat, I can see how you got frustrated! To do a qsort on an array of strings is not the easiest coding chore. Arrays of strings in C drove me to adopt Python long ago! Well, here is modified... |
Forum: C Nov 19th, 2006 |
| Replies: 4 Views: 1,522 Follow your values with a couple of test printf() statements to help you find the errors! Also use scanf("%d", &av[y]);
Your function avg() should really calculate and return a double. |
Forum: C Oct 18th, 2006 |
| Replies: 3 Views: 3,434 Are you trying to printf() a double into an integer format specifier %d?
You could cast to an integer, but it looks like you are flirting with the integer size limits. |
Forum: C Oct 3rd, 2006 |
| Replies: 3 Views: 1,544 You are declaring functions residential_rate(), commercial_rate(), industrial_rate() also as floats of the same name in function main(). Remove those variables and it will work!
Oops, I was too... |
Forum: C Oct 3rd, 2006 |
| Replies: 8 Views: 1,759 I like to do simple C++ things ...
// split a string into its words and load them into a vector
#include <cstring> // for strtok()?
#include <iostream>
#include <vector>
using namespace... |
Forum: C Oct 3rd, 2006 |
| Replies: 22 Views: 3,845 I assume your assignment is to enter 4 weights and calculate the total weight and the average weight. For some odd reason you have found code to calculate weighted averages and threw that in with... |
Forum: C Oct 2nd, 2006 |
| Replies: 22 Views: 3,845 Now that is sweet, except I wouldn't use exit (1), but would rather stay in the input loop. |
Forum: C Oct 2nd, 2006 |
| Replies: 22 Views: 3,845 One mild problem from past experience, if the users enters a floating point number, this loop spins out of control. Give it a try, it's good exercise. |
Forum: C Sep 25th, 2006 |
| Replies: 2 Views: 1,760 Here is a small project, go through all the functions listed at:
http://www.phim.unibe.ch/comp_doc/c_manual/C/FUNCTIONS/funcref.htm
and come up with a code sample of a practical application for... |
Forum: C Sep 15th, 2006 |
| Replies: 14 Views: 62,329 binary 10010 is calculated as 1*16+0*8+0*4+1*2+0*1 = decimal 18
hence b = b<<(len-k) does the multiplication by 1,2,4,8,16 ...
sum = sum + n * b;
// this will explain it ...
printf("%d*%d +... |
Forum: C Sep 15th, 2006 |
| Replies: 14 Views: 62,329 Good for you, but shorter is not always better. There is no error trapping, or explanation/comment how it works! |
Forum: C Jul 5th, 2006 |
| Replies: 14 Views: 62,329 A nice improvement by dilip.mathews! Thanks! |
Forum: C May 27th, 2006 |
| Replies: 3 Views: 2,181 Thanks Dani,
I trust it's you that cleaned up that old && --> should be && problem. |
Forum: C Mar 3rd, 2006 |
| Replies: 7 Views: 4,185 Why do folks assume that old is bad?
The win GUI tutorial at http://www.winprog.org/tutorial/ is great! There is a heck of a learning curve, mostly because the underlying API was written by MS... |
Forum: C Mar 2nd, 2006 |
| Replies: 13 Views: 10,663 Take the string and spell it in reverse. Compare the two strings, if they match you got a palindrome. Now show us some code! |
Forum: C Mar 2nd, 2006 |
| Replies: 7 Views: 4,185 Generally, you create your window and other controls in WinMain() after the call to RegisterClass() and before the start of the event loop. I prefer to put these things into their own functions to... |
Forum: C Sep 26th, 2005 |
| Replies: 3 Views: 2,181 What bumsfeld means is that && should be && (and) |
Forum: C Sep 26th, 2005 |
| Replies: 1 Views: 3,061 This code shows you how to build a multiline story string that should display similarly to way it shows in the code. It should be relatively easy to maintain. |
Forum: C Sep 8th, 2005 |
| Replies: 0 Views: 9,358 Do I have to spell it out for you? This short C code will do just that. It will spell out an integer number in English words. The banks do that on large checks, and it would be nice to get one of... |
Forum: C Sep 4th, 2005 |
| Replies: 1 Views: 3,413 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... |
Forum: C Aug 28th, 2005 |
| Replies: 3 Views: 3,263 Not sure, if this is what you want for displaying a BMP file:
http://www.daniweb.com/code/snippet174.html |
Forum: C Aug 27th, 2005 |
| Replies: 10 Views: 6,806 You got that sort of backwards. First you find a customer with a problem, then you write the software. |
Forum: C Aug 21st, 2005 |
| Replies: 1 Views: 4,353 Moved this duplicate to here! |
Forum: C Apr 24th, 2005 |
| Replies: 3 Views: 1,620 The function strcmp(string1, string2) compares the two strings, string1 and string2, and returns an integer:
< 0 (string1 is less than string2)
0 (string1 is identical to string2)
> 0 ... |
Forum: C Apr 24th, 2005 |
| Replies: 14 Views: 62,329 like the comment says this turns for instance the character '1' to a numeric value 1 |
Forum: C Apr 7th, 2005 |
| Replies: 14 Views: 2,864 Just my imagination, since you could use ( a, a + 10 ) to load the array to a vector and than sort. I imagined cutting out the middleman, in this case the vector. Comes from playing around with... |