5,237 Posted Topics
Re: The first step would be to detect if the opponent is one move away from a winning move, then block that move. [code] X|0|. X|.|0 [COLOR="Red"]O[/COLOR]|.|. [/code] In other words, detect that there are two 'X' in a line, and playing the red '0' is a damn fine idea at … | |
![]() | Re: Perhaps start with a deck of cards (or maybe just one suit for easy handling), and try your algorithm out for real. |
Re: A project entirely of your own invention will be more impressive to prospective employers (it demonstrates that you can really think for yourself), and far more satisfying to you. Rather than saying "some guy on the web told me to do it", and us continually having to refine the ideas … | |
Re: 1. Practice indenting your code. You'll find it a lot easier to follow what is going on. Eg. [code=c++] //***************************************************************************** //Name: <Tisa Knight-Chandler> //Assignment: <Number 7> //File name: <assign7> //Date: <October 31, 2007> //Description This program shall obtain input from the keyboard and compute //a customer's cellular phone bill based … | |
Re: 1. If you say [co[b][/b]de=c], we get line numbers, which makes it much easier to refer to specific parts of the code which are causing you trouble. 2. #define PI = (3.14) This should be just #define PI (3.14) Though you might want to be more precise. | |
Re: Guess which step you [URL="http://www.daniweb.com/forums/thread96213.html"]forgot [/URL]? | |
Re: Read the intro threads at the top of the forum, then post what you've got so far. We're not here to hand complete answers on demand. | |
Re: You read this [URL="http://www.daniweb.com/forums/announcement8-3.html"]http://www.daniweb.com/forums/announcement8-3.html[/URL] You make use of the "Preview Post" button to make sure that your code looks like this [code=c++] int main ( ) { for ( int i = 0 ; i < 10 ; i++ ) { cout << i << endl; } } [/code] And … | |
Re: > especially since OP has apparently never been back after getting his answer to it... Nor has the drive-by thread-bumper for that matter ;) But to see how easy it is, watch Mythbusters on the Discovery Channel, and watch the "Crimes and Mythdemenors" episode. Fingerprint scanners do not come out … | |
If I leave the language out of the code, then I can use colour just fine, like so [code]printf("%d. file has been created[COLOR="Red"]\r[/COLOR]",i); fflush(stdout);[/code] But if I add a language, say 'c', then it all goes pear shaped and the colour tags are no longer parsed. [code=c]printf("%d. file has been … | |
Re: Well if the sheet starts out blank, then the second student knows a hell of a lot about the first student. How would you solve this problem? | |
Re: Show us how test->GetMpModif() is implemented. If in debug, the member variable is fine, then my guess would be either - the 'get' function is doing the wrong thing. - the class instance may already have gone out of scope (check the dtor to see if it's called). | |
Re: Show some [URL="http://www.daniweb.com/forums/announcement125-2.html"]effort[/URL] Use [URL="http://www.daniweb.com/forums/announcement125-3.html"]code tags[/URL] | |
Re: [URL="http://en.wikipedia.org/wiki/All_your_base_are_belong_to_us"]All the base belong to Daniweb[/URL] | |
Re: > scanf("%d", n); Are you using gcc? Have you considered [ICODE]gcc -W -Wall prog.c[/ICODE] You forgot the &, which the above compiler/warning options would tell you. | |
Re: May as well just visit [URL="http://www.cs.fredonia.edu/cswebpage/"]http://www.cs.fredonia.edu/cswebpage/[/URL], click on the "staff" link, figure out which tutor set the homework and then email them directly with a message saying "the following students would like to submit this answer". | |
Re: My advice would be to put the problem aside for a month and get some basic C++ under your belt first. Look for a book called "Accelerated C++". Hacking away at the problem one post at a time on a forum isn't going to produce a meaningful product at the … | |
Re: [url]http://www.lvr.com/serport.htm[/url] | |
Re: > if (status == 'm' || 'M') Should be [icode]if (status == 'm' || status == 'M')[/icode] | |
Re: Hard to say without a better idea of how your different classes relate to one another. What type is vptr for example? Separating the code into two functions - input data - print data would help with following what's going on. | |
Re: You could try [code]printf("%d. file has been created[COLOR="Red"]\r[/COLOR]",i); fflush(stdout);[/code] Note the \r (carriage return), which should return you to the start of the current line, whereas \n is newline. | |
Re: I suppose you could do this, just to see who's awake ;) [ICODE]for(code = *"A";code <= 0["Z"]; code += 1)[/ICODE] /runs. | |
Re: `a * b` will be OK if `a < [DBL_MAX] / b` (http://www.cplusplus.com/reference/clibrary/cfloat/) | |
Re: Yes we can help you, but you've got to make [URL="http://www.daniweb.com/forums/announcement8-2.html"]the initial move yourself[/URL] | |
Re: Another good thing to check is to see if you've spelt the name correctly. If for example you mis-spelled "hash_login" as "hasp_login", it would show that error message. Edit: > hasp_login is a function. that is defined in one header file The header file only tells the compiler that the … | |
Re: Yet another post showing all kinds of creative use of posting tags, except for the one which [URL="http://www.daniweb.com/forums/announcement8-3.html"]really matters[/URL]. | |
Re: > any suggestions?? Yes, don't write so much code without pressing "compile", or running the result. Step 1 would be [code=c++] int main () { return 0; } [/code] Compile and run. It should be trivial right? Step 2, add ONE function. [code=c++] #include <iostream> using namespace std; void programDescription … | |
Re: While you're single-stepping the code, you should also be running through your head your impression of what needs to happen to the data (or following through on paper what you designed to happen). When what is actually happening is different from what you thought should happen, stop running the code … | |
Re: > may is end the code of this program over hear. Something along the lines of this perhaps? "May (please will) you send the code of this program over here (to me)" | |
Re: So what was wrong with the answers in your [URL="http://www.daniweb.com/forums/thread95479.html"]previous thread[/URL]? | |
Re: > I'm using TurboC (OS is winxp). Get a real compiler then. You've bought a Ferrari, and you've taken the engine out and instead tided a horse to the front of it. For example, however many GB of memory you have, your compiler only sees 640K of it. > scanf: … | |
Re: It would be far more useful if you experimented with the code tags as opposed to the colour tags. | |
Re: Planned by bush and his cronies - not a snowball in hell's chance. Allowed to happen through incompetence and inaction of one or more previous administrations - pretty likely. Caused by US foreign policy which continues to honk off a large majority of the worlds population with it's "we're all … | |
Re: Something simple like a for loop to check each character in turn perhaps? | |
Re: 1. Don't hijack threads which are 2.5 YEARS old with some random 1-liner "me too" post. 2. When you do get around to posting something meaningful, if it's code or error messages, then use the CODE tags to make sure it remains readable. Did you miss all the intro threads, … | |
Re: I guess the first step would be to determine if such a thing is even possible. [URL="http://mathworld.wolfram.com/"]http://mathworld.wolfram.com/[/URL] | |
Re: How is gambling on your own skill any different from gambling on someone else's skill? | |
Re: > what would gcc produce as a result? The compiler might infer that both operands are known at compile time, and simply store 25 in a and d. The compiler might also infer that none of the calculations are used, and remove them completely, thus reducing the program to [icode]return … | |
Re: At a rough guess, the & in your directory path is confusing something. The & character is used for several different purposes by several different shells, so who knows what it did with it. | |
Re: 1. Saying "an error" isn't good enough, copy and paste the actual error message(s). 2. Use code-tags when posting code, then it's all nice and neat. 3. main returns an int, not void. > `cout <<getMonthName(month)<<endl;` You can't print a void! Maybe just call the function and let it do … | |
Re: Since this is a C++ program, use the C++ I/O mechanisms. Or to fix the immediate line of code. [icode]fprintf(pFile, ListViewTextItem[i].c_str() );[/icode] | |
Re: A const in C++ replaces the #define in C. [code=c++] #include <iostream> int main ( ) { const int magic = 42; int *breaker = (int*)&magic; std::cout << magic << " " << *breaker << std::endl; ++(*breaker); /* there goes all the const correctness */ std::cout << magic << " … | |
Re: Because you used a signed type, and your unsigned value is outside the permitted range of your machine. You also used the wrong printf format, try %lu instead. | |
Re: > what is the problem? No idea, but first some warnings. [code] gcc -W -Wall -ansi -pedantic -O2 foo.c foo.c: In function `main': foo.c:10: warning: unsigned int format, long unsigned int arg (arg 2) foo.c:11: warning: unsigned int format, long unsigned int arg (arg 2) foo.c:15: warning: unsigned int format, … | |
Re: > if each of us had planted our own vegetation and food in general and then trade 1. Unless you're already a farmer, or rich enough to own a house with a substantial garden, then very few people have the resources to plant enough crop to sustain themselves. 2. If … ![]() | |
Re: My "instinct" is that most drugs should be legal. In tandem with that, there should be some meaningful (and enforced) laws regarding their abuse. In particular, the penalty for killing someone whilst DUI is considerably less than for killing someone by any other method. On the one hand, society should … | |
Re: [url]http://catb.org/~esr/faqs/smart-questions.html#writewell[/url] How about adding to your C++ program an option to save the screen to let's say a BMP file? | |
Re: > UShortFrame* usframe = new UShortFrame; > delete []usframe; You didn't allocate an array, so drop the [ ] from the delete. > 1. return me frame specified in the 'counter'. > 2. The file needs to be closed only when 'stop' has value say 'STOP' > 3. The file … | |
Re: [url]http://www.daniweb.com/forums/announcement118-2.html[/url] So show us what you can do, say - write a program which reads 10 integers and prints them back to the user. Look at whatever programs you've already written and try to adapt what you've learnt so far to the new problem. Then build on that a step … | |
Re: I thought it was Oxygen Hydride, and [B]D[/B]at's [B]M[/B]y [B]H[/B]umble [B]O[/B]pinion :) |
The End.