4,305 Posted Topics
Re: It looks to me that you are reading data into a buffer that does not get deleted at the end. Check your code for the ever so elusive buffer. | |
Re: One way to do this, which is easiest on the user, is to extract the numeric content of the entry and go on. Here is a simple code snippet: [php]// A foolproof input routine for numbers: // The input string is analyzed for nondigit characters // which are removed, the … | |
Re: I used to play around with Borland BGI graphic stuff more than twenty years ago, and am amazed that this thing still hangs around. When Windoze first came out, I learned to use the Graphics User Interface (GUI) and a bunch of API calls to do graphics. I am quite … | |
Re: I hope this is not homework! That would be cheating! This will do something like that, learn from it: [php] #include <iostream> #include <iomanip> // for setw() #include <stdlib.h> // for system() using namespace std; int main() { int k; int scores[50]; // array to hold 50 integers // initialize … | |
Re: Attached is an HTML file (zipped) that has all the information about disks you ever wanted. | |
Re: Since you are writing a C program use getchar() to wait. [code]// you can also use just #include <iostream> // this works in DevCpp because iostream chain-includes down // to sdtio.h (not recommended for portable code) #include <stdio.h> int main() { printf("Hello, world!\n"); getchar(); // wait return 0; } [/code] | |
Re: The getpid() function gets the (unique) process identification from the system. You need to include the process.h header. Beware, this function is not standard C. [code]#include <stdio.h> #include <process.h> int main() { printf("This program's process identification number (PID) " "number is %X\n", getpid()); printf("Note: under DOS it is the PSP … | |
Re: There is a DOS based tile game with mouse support written in Turbo C++, check: [php] http://www.programmersheaven.com/d/click.aspx?ID=F26995 [/php] | |
Re: How about this one? It's also in the C code snippets. I never knew it would work for anything below 1900, but it shows 01/01/1800 to be a Wednesday. [php]// function to return the day of the week given the date // Original Turbo C modified for Pelles C #include … | |
Re: Try this, works well with the free Dev C++ compiler. [php]// display arrow characters with Dev C++ #include <iostream> using namespace std; int main() { char left,right,up,down; up = 24; down = 25; left = 27; right = 26; cout << up; cout << down; cout << left; cout << … | |
Re: You will not be adding up your total with something like =+ the correct operator is += Unless you have to use double return key, I would go with something as simple as t1 and flag down the 't' character to exit the loop. | |
Re: This site has an example of eyes folowing the cursor. The program is for Visual C++ and is surprisingly simple. Download Tom and Jerry from: [url]http://www.cwinapp.com/tutorials/sourcecode/045.zip[/url] also look in the fun stuff section of this great website! There is enough English there to find your way around. It also gives … | |
Re: The VB6 Working Model is floating around for almost free on a CD ROM with a number of books. I picked up "Sams Teach Yourself Visual Basic 6 in 24 Hours" at Borders for $19.99. The VB6 Working Model performs well, but lacks the help files. At least you get … | |
Re: Just Extreme's code a little tidied up for Dev C++ Hope you can see the flow of things. [code]// Dev C++ code #include <iostream> using namespace std; int main() { int k, m; for(k = 1; k <= 10; k++) { // outputs 1,2,3,...,10 stars for(m = 0; m < … | |
Re: You might want to look into Visual C++ Express. The beta version of this "student edition" is still free at: [url]http://lab.msdn.microsoft.com/express/visualc/[/url] | |
Re: Take a beginner's look at: [url]http://gd.tuwien.ac.at/languages/c/programming-bbrown/cstart.htm[/url] The best way to get the hang of it is to write a few programs. There is also a great free C compiler at: [url]http://smorgasbordet.com/pellesc/index.htm[/url] | |
Re: Take a look at: [url]http://gd.tuwien.ac.at/languages/c/programming-bbrown/cstart.htm[/url] At this point, don't waste your money on poorly written and mostly outdated books. | |
Re: You can look under Line and Curve Functions in the Win32 Programmer's Reference. | |
Re: The "undetermined character constant" was just one error. I fiddled with the code a little, take a look: [php]// student's grades Dev C++ #include <iostream> #include <ctype.h> // toupper() using namespace std; class student { private: char st_name[25]; char st_major[25]; int i_test1; int i_test2; int i_test3; int i_average; char ch_grade; … | |
I found this neat little GUI calculator program on the net. It uses a function called _gcvt(double val,int limit,string cBuf), which seems to be used to convert a double val to a string cBuf, with some formatting and limiting. I replaced it with sprintf(), but the output looks rather crude … | |
Re: There is one site I like (black on white): [url]http://gd.tuwien.ac.at/languages/c/programming-bbrown/cstart.htm[/url] and just for reference and comparison of C vs C++ look at: [url]http://www.cppreference.com/[/url] Don't worry, most C++ compilers handle C just fine. | |
Re: Here is a little Delphi code that gives you just a hint: [code]// get the hard drive serial number (Delphi Pascal) procedure TForm1.SerialNumberButtonClick(Sender: TObject); var VolumeSerialNumber : DWORD; MaximumComponentLength : DWORD; FileSystemFlags : DWORD; SerialNumber : string; begin GetVolumeInformation('c:', nil, 0, @VolumeSerialNumber, MaximumComponentLength, FileSystemFlags, nil, 0); SerialNumber := IntToHex(HiWord(VolumeSerialNumber), 4) … | |
Re: For a very detailed look at ListBoxes go to: [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listboxes/listboxes.asp[/url] Otherwise you have to write a little function to pad the string with spaces on the left. | |
Re: Alfred E. Newman comes to mind with Mickey Mouse as vicemouse. Honestly, it doesn't matter, all these folks live in a different world! Dani would at least care about the younger folks. | |
Re: This will get close, looked it over in the morning ... [php]// This program calculates the total surface area of a pool wall // and estimated construction cost Dev-Cpp #include <iostream> #include <stdlib.h> using namespace std; int main(int argc, char *argv[]) { int depth,length,width,total; int surface; const double PRICE_SQ = … | |
Re: There is a C code snippet in this forum under "Day of week given a date" that can give you an idea. | |
Re: Just a hint! Mixing up l and 1 are easy to do and hard to catch reading the code. I would use slightly more meaningful variable names like q and r. Also avoid using the often used i in loops and counters, it is another hard to read character, replace … | |
Re: double fmod(double x, double y) is a function, so you have to rewrite your code a little. It returns the remainder of the division x / y. Make sure to #include <math.h> | |
Re: Breaking out of a loop does not necessarily mean the use of the break statement. The way you wrote the while loop does it for you. [php]// exit a loop (Dev-C++) #include <iostream> using namespace std; int main(int argc, char *argv[]) { char answer; while((answer != 'Q') && (answer != … | |
Re: [QUOTE=N3wbi3C0d3r]I tried to do something similar but much more simple, but i dont know what i did wrong. Wont compile it right. [CODE] //Clock for seconds #include <iostream.h> int main () { int HH; int MM; int SS; int result; cout << "Enter Hours :HH:"; cout << " "; cin … | |
Re: [QUOTE=kakilang][PHP]#include<iostream> using namespace std; int main() { cout<<"Hellp World"<<endl; return 0; }[/PHP][/QUOTE] Freudian slip, do you want the world to hellp you, or do you think the world needs hellp? Anyway, cute! | |
Re: keybd_event() is a Windows API call ... The keybd_event function synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls the keybd_event function. VOID keybd_event( BYTE bVk, // virtual-key code BYTE bScan, // hardware scan code … | |
Re: Wow, variables and types are a mess here! Narue is right, the compiler will bitch! Oops, where did the structure type come from? Eric, doing this thing in small stages might help! Like your input section, comment out the other code, Compile and test each stage! | |
Re: Man, this gets my rusty brain working. exp(1/3*(ln(x))) gives you the cuberoot of x ln(x) can be found to the nth degree of accuracy via binary expansion and exp() via continued fraction expansion. This is a hint, go at it tiger! | |
Re: This one is still looking for a name! Warning from the Department of Energy: There's a new computer virus on the loose that's worse than anything we've seen before! It gets in through the power line, riding on the powerline 60 Hz subcarrier. It works by changing the serial port … | |
Re: Boreland has a very nice site to update help files: [url]http://info.borland.com/techpubs/borlandcpp/[/url] | |
Re: Get the Dev C++ compiler package from: [url]http://www.bloodshed.net/[/url] and the Pelles C compiler package from: [url]http://smorgasbordet.com/pellesc/index.htm[/url] Both are free and contain an IDE to write and compile your programs from. | |
Re: To get out of loop I have used the following macro: [code] #define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0) if KEY_DOWN(vk_q) ... [/code] vk_q is simply the ascci value of q | |
Re: Pelles C is a complete system with an IDE. It is still very active, and best of all it's free. Download from: [url]http://smorgasbordet.com/pellesc/index.htm[/url] For something a little different you might want to download the BCX system, also free from: [url]http://www.rjpcomputing.com/programming/bcx/devsuite.html[/url] Look at BCX as a preprocessor for Pelles C (or … | |
Re: To get your feet wet, go from basic to C/C++. I like BCX, a free basic to C translator. The generated C/C++ code that is then compiled. You don't have to get involved with C/C++ right away. However, if you want to be a programmer you should. BCX is the … | |
Re: This does look like C code. It looks to me like you are just reading one element of your data file. I would read this into an array and go from there. What does your data file look like? Are you simply writing the same file back out? This code … | |
Re: This might help you with the arrow keys: [code]// trap the arrow keys // note: Pelles C uses _getch() rather than getch() #include <stdio.h> #include <conio.h> static int get_code ( void ); // System dependent key codes enum { KEY_ESC = 27, ARROW_UP = 256 + 72, ARROW_DOWN = 256 … | |
Re: [QUOTE=Narue]>I can't get anything to work on the hybrid version. Can anyone help, provide tips or pointers? Oddly enough, I posted the full implementation for an optimized quicksort in the code snippets on this site. One of the optimizations is terminating recursion on small subfiles and then calling insertion sort … | |
Re: Simply draw a small circle or display the picture of a round button and make it respond to it's mouse_down event. | |
Re: I hope this is what you had in mind. The enclosed function evaluates a string like 123/3.1 or 12345679*63 and returnes the calculated value. Enter this string in your main() and call the function. [code] /********************* calc_val.cf ****************************** ** ** Parse a calculator string (eg. 5.7/3.2 or 4.2*9.7) for ** … | |
Re: [QUOTE=Narue][code] <a href="link" onMouseOver="document.image.src='on.gif'" onMouseOut="document.image.src='off.gif'"> <img src="off.gif" name="image"> </a> [/code] It's pretty simple really, onMouseOver and onMouseOut are events that are triggered when the obvious happens: the mouse enters or leaves the image boundary. document is the current HTML file, image is the name of the image we're working with, … | |
Re: [QUOTE=minnie][B]Is it possible to convert from VB code to C and what is the best way to do this?[/B][/QUOTE] visit: [url]http://bcx.basicguru.com/[/url] and get a hold of BCX. Kevin Diggins migrated from VB to C/C++ a few years ago and wrote BCX, a basic to C translator that has been updated … | |
Re: I dusted off this little code snippet from the good old DOS days. It will answer some of your questions on how to calculate the musical scales. If you need any more details, get friendly with a musician! [code] /*********************** play.c *********************** ** ** Experimentation with sound: ** play(int octave,int … | |
Re: [QUOTE=kind4ever]thanks alot cause Iam study this language at first time and its difficult and I wanna help to understand it and i ask you what is a pointer in c++ and how can work? plz explain to me[/QUOTE] There is a nice tutorial on pointers right here on DaniWeb. Look … | |
Re: Here is some C code that might help you get started. [code]// A linear list of data accessed first in, first out (FIFO) is called a QUEUE. // Pelles C (vegaseat) #include <stdio.h> // in/out function header #include <string.h> // string function header #include <stdlib.h> // malloc() void enter(void); void … |
The End.