5,237 Posted Topics

Member Avatar for megan-smith

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 …

Member Avatar for WaltP
0
174
Member Avatar for chris53825

Perhaps start with a deck of cards (or maybe just one suit for easy handling), and try your algorithm out for real.

Member Avatar for Salem
0
128
Member Avatar for FrankHere

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 …

Member Avatar for Salem
0
173
Member Avatar for talk2tisa

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 …

Member Avatar for talk2tisa
0
113
Member Avatar for LilLady

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.

Member Avatar for Duoas
1
143
Member Avatar for dblbac

Guess which step you [URL="http://www.daniweb.com/forums/thread96213.html"]forgot [/URL]?

Member Avatar for tracethepath
0
100
Member Avatar for poiuy

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.

Member Avatar for Salem
0
63
Member Avatar for dblbac

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 …

Member Avatar for Ancient Dragon
0
149
Member Avatar for rouge

> 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 …

Member Avatar for jwenting
0
273
Member Avatar for Salem

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 …

Member Avatar for Dani
0
131
Member Avatar for algo_man

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?

Member Avatar for Salem
0
61
Member Avatar for Shay_

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).

Member Avatar for Salem
0
72
Member Avatar for agramma

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]

Member Avatar for Salem
0
51
Member Avatar for Alethea

[URL="http://en.wikipedia.org/wiki/All_your_base_are_belong_to_us"]All the base belong to Daniweb[/URL]

Member Avatar for Narue
0
136
Member Avatar for piscean123

> 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.

Member Avatar for piscean123
0
138
Member Avatar for AXAsianXie

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".

Member Avatar for Salem
0
120
Member Avatar for noobyjoe

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 …

Member Avatar for noobyjoe
0
166
Member Avatar for fhshockey05d
Member Avatar for abarnett

> if (status == 'm' || 'M') Should be [icode]if (status == 'm' || status == 'M')[/icode]

Member Avatar for WaltP
0
3K
Member Avatar for Dee76

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.

Member Avatar for vijayan121
0
653
Member Avatar for asilter

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.

Member Avatar for Salem
0
94
Member Avatar for piscean123

I suppose you could do this, just to see who's awake ;) [ICODE]for(code = *"A";code <= 0["Z"]; code += 1)[/ICODE] /runs.

Member Avatar for Narue
0
147
Member Avatar for cowboy4mhell

`a * b` will be OK if `a < [DBL_MAX] / b` (http://www.cplusplus.com/reference/clibrary/cfloat/)

Member Avatar for Salem
0
78
Member Avatar for k7_keshav

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]

Member Avatar for k7_keshav
0
95
Member Avatar for nshh

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 …

Member Avatar for tarekkkkk
0
205
Member Avatar for notathing

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].

Member Avatar for Salem
0
74
Member Avatar for jamesny89

> 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 …

Member Avatar for Salem
0
160
Member Avatar for joshmo

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 …

Member Avatar for Salem
0
116
Member Avatar for tech2chill

> 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)"

Member Avatar for tech2chill
2
479
Member Avatar for BensonRoss

So what was wrong with the answers in your [URL="http://www.daniweb.com/forums/thread95479.html"]previous thread[/URL]?

Member Avatar for Salem
0
81
Member Avatar for MiTiM

> 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: …

Member Avatar for Salem
0
284
Member Avatar for pdwivedi

It would be far more useful if you experimented with the code tags as opposed to the colour tags.

Member Avatar for WaltP
0
124
Member Avatar for Dave Sinkula

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 …

Member Avatar for jwenting
0
517
Member Avatar for BensonRoss
Member Avatar for Aia
0
183
Member Avatar for aaabhish

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, …

Member Avatar for Salem
0
164
Member Avatar for chanah

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]

Member Avatar for Salem
0
87
Member Avatar for Duki

How is gambling on your own skill any different from gambling on someone else's skill?

Member Avatar for jbennet
0
100
Member Avatar for n.aggel

> 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 …

Member Avatar for n.aggel
0
160
Member Avatar for Jobe007

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.

Member Avatar for Salem
0
51
Member Avatar for nicz888

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 …

Member Avatar for vijayan121
0
95
Member Avatar for curt22

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]

Member Avatar for Salem
0
95
Member Avatar for rugae

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 << " …

Member Avatar for vijayan121
0
130
Member Avatar for asilter

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.

Member Avatar for Salem
0
114
Member Avatar for asilter

> 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, …

Member Avatar for Salem
0
155
Member Avatar for zandiago

> 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 …

Member Avatar for iamthwee
0
218
Member Avatar for Dave Sinkula

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 …

Member Avatar for scru
3
778
Member Avatar for akame

[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?

Member Avatar for Salem
0
68
Member Avatar for aus_fas1

> 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 …

Member Avatar for Salem
0
148
Member Avatar for piscean123

[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 …

Member Avatar for piscean123
0
100
Member Avatar for Dave Sinkula
Re: Dmho

I thought it was Oxygen Hydride, and [B]D[/B]at's [B]M[/B]y [B]H[/B]umble [B]O[/B]pinion :)

Member Avatar for MidiMagic
0
103

The End.