4,305 Posted Topics
Re: Sounds like you want to sit down do some actual programming. Take some code samples from books or the code snippets here on DaniWeb and run them through your compiler. See what they do, then experiment with the code, improve and embellish. Read lots of books or online info while … | |
Re: Heck, its an old thread, but I just discovered it! Here is my wooden nickel's worth. Python is an interpreted language. It has its origins in C, ABC and Modula2, and reads like pseudocode. It is very object oriented, just about everything is an object in Python. Yes, it is … | |
Re: If you really want to learn C++ from a package deal I recommend this ... Get yourself the book "Standard C++ Bible" by Stevens and Walnum, published by Hungry Minds. This 800 page plus book is loaded with samples and comes with a CD-ROM containing all the samples and a … | |
Re: Windows GUI programming is not my métier, but I took the liberty and replaced #include "Skeleton.h" with #include <windows.h> Also replaced the two references to icon resources (hInstance, MAKEINTRESOURCE(IDI_SKELETON)) (hInstance, MAKEINTRESOURCE(IDI_SKELETON_SM)) with the more customary (NULL, IDI_APPLICATION) If you don't have the proper resource file, the reference to IDI_SKELETON and … | |
Re: First of all avoid the '\221' and '\222' and '\224' characters, the compiler does not like them, use ' or " where appropriate! Also use {"A", "Alpha"} and so on in your array of strings. Change ans to answer Once you get the program to compile you can work on … | |
Re: Darn, I have seen those little program codes float around and never saved one. You need to google, it should uncover one of them. Got to narrow it down from just "wallpaper" though, or you get 99% BS! | |
Re: There is a code snippet here on DaniWeb called "Plot a Sinewave to the Console" that addresses some of your concerns. Check out: [url]http://www.daniweb.com/code/snippet217.html[/url] | |
Re: Look at a number of the code snippets here on DaniWeb, some of them deal with sound. | |
Re: I think this is what WinBGI and this little code snippet is all about. [url]http://www.daniweb.com/code/snippet176.html[/url] | |
Re: >I am new at programming and need help: #include <iostream> #include <cmath> using namespace std; int main() { int a, b, c, area, tri_area; area = tri_area(a, b, c); if area (area>0); cout << "Area is "<<area<<"!"<<endl; cout << " Those values tri_angle " <<endl; } double tri_area (double a, … | |
Re: I think JoBe got it, folks are smart in Belgium! Just in case there are some stragglers, here is another twist to Dave's wonderful code. I am trying to make the whole thing more visible ... [php] // bitwise operations << shift left, >> shift right, & bitwise AND // … | |
Re: [QUOTE=jonnie83]I am having a problem with inputs. I can get the input using the cin command but i want to use the input to open a file with the inputs name ie the user types in FRED. cin>>name i want to open a file called fred.txt ifstream in("name.txt"); the above … | |
Re: Take a look at: [url]http://www.daniweb.com/code/snippet139.html[/url] It might just give you an idea. | |
Re: The iostream header that comes with the Dev-C++ package does take care of ye system() function (through seemingly endless internal includes). Be aware that this is not true for other C++ compilers. They may require the cstdlib header. Also system("pause") is strictly a DOS call and is not portable to … | |
Re: There is a code snippet called "algorithm uses in scheduling between RAM and CPU" at: [url]http://www.daniweb.com/code/snippet6.html[/url] It just might help you on your scheduling adventure. | |
Re: To someone just starting out, "free" may be best. Also a nice IDE, help and debugging may be very important. Just like with the best car, "speed" isn't all there is! Dev-C++ and the GNU stuff may not be a racehorse, but it is a good workhorse and it is … | |
Re: [QUOTE=Intel]Oh man, you even don't know the down side of "goto" stmt in C++? Crab, well then i should not [B]waste my time[/B] replying to your posts.[/QUOTE] The much maligned goto statement has a good and healthy reason to be part of the language. One of the best reasons is … | |
Re: Microsoft supplies the runtime version of .NET Frameworks freely, you will have to distribute that along with your executable file. At least that is my understanding. Eventually all Windows machines will have .NET Frameworks installed right out of the box. What a wonderful world that will be!!!! | |
Re: Dave, you need to change your input loop and call your functions when you want to calculate area, cost and price. On cursory look, this is what I would recommend ... [php] // David Shaw // Lab 3 - Functions // 02/18/05 #include <iostream> ///#include <iomanip> // not needed! using … | |
Re: You have the worst book ever written in the dummies series. This author couldn't write his way out of a paperbag was the opinion of one of the critics. ![]() | |
Re: Fill us in on YACC and give us a Hello World! Does it stand for Yet Another C Compiler? | |
Re: Might work for you, check this C snippet on DaniWeb: [url]http://www.daniweb.com/code/snippet64.html[/url] | |
Re: This would be an example of a stack of integers using a list ... // example of a stack (Last In First Out = LIFO) using a list // compares to a stack of dinner plates // Dev-C++ #include #include using namespace std; int main() { list iL; int k; … | |
Re: I can and will only give a hint, look at: [url]http://www.daniweb.com/code/snippet6.html[/url] | |
Re: As Narue so kindly pointed out, you went past the array, that gets you into garbage values. There is also a casting problem with the variable validate. You may want to add checks for non-numeric input, or you get into strange loops! I don't have VC++ up, so I tested … | |
Re: frrossk did a great job helping you! Please put the following lines near the end of your code, just above return 0; to make the console display wait: [php] cin.get(); // trap return cin.get(); // wait till key pressed [/php] there are a couple of other things to be worked … | |
Re: use the two functions clear() and length() [php] string str1 = "Judges live on income"; string str2 = " fixed"; cout << "before clear: " << str1.length() << endl; str1.clear(); cout << "after clear: " << str1.length() << endl; // now do the same thing with str2 [/php] | |
Re: My son took the Deitel to college with him, sorry can't answer your many questions. A lot of them are actually answered in Al Stevens' Standard C++ Bible. | |
Re: For simplicity sake let's use the perfectly unsafe gets() function. [php] ... char filename[80]; char extension[] = ".csv"; puts("Enter filename (no extension):") gets(filename); strcat(filename, extension); ... [/php] This assumes that the user has some kind of brain. If the user is brainless you have to detect the period character in … | |
Re: Just a hint, after doing Dave's corrections study up on the modulus operator % ... | |
Re: I took the liberty to show your first example to my students today as a masterpiece of bad coding style. This is what they came up with, modified to work on Dev-C++ and in acceptable style. Please look at it and learn!!! [php]// grading example Dev-C++ #include <iostream> using namespace … | |
Re: [QUOTE=lrea_fallon]I am a begging Assembler Student and I am having problems. When I run my program it is telling me I have a bad ASA control charecter. I have checked my program and I don't see anything wrong with it. Does anyone know what the problem could be?[/QUOTE] I would … | |
Re: Most browsers leave a heck of a trail all over your drive, there is no escape! So use your best judgement what you are browsing for ... | |
Re: I would say use HTML and a little JavaScript to change the cursor. Look at this code snippet here on DaniWeb to get a hint. [url]http://www.daniweb.com/code/snippet179.html[/url] | |
Re: The function is called CreateFont(), not something for the faint at heart! [php] HFONT CreateFont( int nHeight, // logical height of font int nWidth, // logical average character width int nEscapement, // angle of escapement int nOrientation, // base-line orientation angle int fnWeight, // font weight DWORD fdwItalic, // italic … | |
Re: This is from the Borland site: rand() uses a multiplicative congruential random number generator with period 2 to the 32nd power to return successive pseudorandom numbers in the range from 0 to RAND_MAX. The symbolic constant RAND_MAX is defined in stdlib.h Typical example: [php] #include <stdlib.h> #include <stdio.h> #include <time.h> … | |
Re: Would be rather simple in HTML, but since you posted this in C/C++ I assume you want to get an idea in those languages. Check the code snippet "Mouse-over (rollover) effect in a Windows GUI program" at: [url]http://www.daniweb.com/code/snippet88.html[/url] You have to change the cursor in WinMain() and put the images … | |
Re: [QUOTE=helmica]hi all am having hard times since yesterday trying to solve this problem. Declare the following two integer lists: int a[] = {5, 8, 4, 1, 7}, b[] = {12, 3, 15, 6, 23, 1, 2}; int sizeA = sizeof(a)/sizeof(int), sizeB = sizeof(b)/sizeof(int); list<int> list1(a, a+sizeA), list2(b, b+sizeB); Use the … | |
Re: Study up on printf(), particularly the width format specifier. Apply this to sprintf() within your function. Most help files that come with the compilers should give you all the details. | |
Re: [QUOTE=wildkms725]Thank you for you help. Is there any way that I can combine the two .cpp files into one?[/QUOTE] Just combine them in your editor. Put all the header files near the top and sort them out for duplicates. Also obvious things like #include "search.cpp" are not needed any more. … | |
Why are the standard header files in C++ so non-standard? Particularly iostream seems to be the most dialectal. Enough to make the whole language a mess to work with! | |
Re: Roll your own, it's just too simple ... [php] if (number < 0) number = -number; [/php] | |
Re: [QUOTE=Siersan]Using strchr it would look something like this. [code] #include <stdio.h> #include <stdlib.h> #include <string.h> int check(char str[], int search); int main(void) { char buf[BUFSIZ]; int ch; printf("Enter a string: "); fflush(stdout); if (fgets(buf, sizeof buf, stdin) == NULL) return EXIT_FAILURE; printf("Enter a character to search for: "); fflush(stdout); if … | |
Re: When in doubt, use the old workhorse printf(). I have played around with manipulators like [php]cout << setfill('0') << setw(8) << d1; [/php] with results that cause only consternation. The old printf() like Chainsaw mentioned works well: [php]// right justified numeric output (Dev-C++) #include <cstdlib> #include <iostream> // may have … | |
Re: Take a look at the C or C++ code snippets here on DaniWeb ... The very top line of this page. | |
Re: Dave is right, increase your array dimension from 6 to 7. Actually your example ran into troubles with element 5 already. Here is the test code: [php]// a test of the morse code #include <stdio.h> // morse codes char m[57][7] = {".-..-.", "", "", "", "", ".----.", "-.--.-", "-.--.-", "", … | |
Re: If you just want to view images, there is a simple C code snippet on DaniWeb: [url]http://www.daniweb.com/code/snippet86.html[/url] It's called "Displaying a JPEG image using Windows GUI", it will also display BMP and other images. | |
Re: Compare this code to your code and it will give you a hint why yours does not work. [php]#include <iostream> int order_chars( int*, int*, int* ); int main() { int c1 = 5; int c2 = 10; int c3 = 15; int* c1ptr; int* c2ptr; int* c3ptr; c1ptr = &c3; … | |
Re: You may want to take advantage of STL set. [php]// the STL set is a sorted unique element container // Dev-C++ #include <cstdlib> #include <iostream> #include <set> // stl header #include <iterator> // ostream_iterator using namespace std; int main(int argc, char *argv[]) { set<int> iST; int num; cout << "Enter … |
The End.