2,045 Posted Topics

Member Avatar for kalyanponnala

Try them as: [code] #include <climits> #include <cstdio> #include <cstdlib> [/code] These are the includes for use in standard C++ programs. I'm not sure what that other file is. A brief net search indicates it might be a *nix file which you will not find in the Visual Studio and …

Member Avatar for jonsca
0
341
Member Avatar for themarval

Your function declaration(s) (hint there) will go into your header file. So like what you have in your second code box but with a name of the function. Think over how you're going to determine which is which. You don't need to declare your variables outside of main() like that. …

Member Avatar for jonsca
0
172
Member Avatar for PDB1982

Should be [icode] HotDogStand * CartSales = new HotDogStand[numCarts]; [/icode]. Any time you are using new in C++ the return value is a pointer to that type.

Member Avatar for WaltP
0
174
Member Avatar for vincenzorm117
Member Avatar for vincenzorm117
0
109
Member Avatar for XinJiki

If you adjust your function's signature to: [icode]void addNames(ifstream& fin, ofstream& fout) [/icode] (the parameters used in the function body must match those in the signature) you can avoid the global variables.

Member Avatar for Shinedevil
0
254
Member Avatar for DiscoJesus

switch needs {} around the cases e.g. [code] switch(var) { case 0: do stuff; break; case 1: do stuff; break; } [/code]

Member Avatar for Reisuke
0
1K
Member Avatar for angels21usa

[quote]the first number after 9 that cannot be divided by 2 and 3, which would be 25 [/quote] Perhaps I'm missing something but I don't really follow the logic of this statement at all. There are a bunch that cannot be divided by 2 or 3 or both. If this …

Member Avatar for angels21usa
0
96
Member Avatar for sidd.

[quote]e.g. 3.4 to 3 [/quote] [quote]Math.Ceiling(ValueToRoundup) [/quote] Except calling Math.Ceiling() on 3.4 will give you 4.0 not 3.0.

Member Avatar for Geekitygeek
0
195
Member Avatar for samratfriendz

choice is local to the method it's declared in. However if you declare a variable choice in main (it could be called anything really I was just matching it up with your switch statement) and use it like [icode] choice = Menu(); [/icode] Then it will display the menu and …

Member Avatar for samratfriendz
-1
1K
Member Avatar for wtvrinc

What I would do is use a low-tech method: read the line into a string using getline() and step through it to count the spaces. If you don't have all the numbers you need, record the line number of the bad data, throw out the string and read another line. …

Member Avatar for kesh1000
0
89
Member Avatar for ndali

Put two slashes in front of line 1. After line 1 insert the following: [code] int main() { return 0; } [/code] I'd hold the envelope to my forehead but that's just been overdone.

Member Avatar for jonsca
-1
55
Member Avatar for react05

Where do you have the declaration and definition of the first code box above? You most likely need to put the declaration (top line) into your class declaration with the friend keyword in front of it. Then just include the definition in your implementation file.

Member Avatar for jonsca
0
48
Member Avatar for alexa868

Change the name of setX to Roll. Add a statement to Roll to set the old value to another private member variable. Make a new setX that has the signature [icode] void setX(int value) [/icode] which is only used to set the value of the die if necessary.

Member Avatar for jonsca
0
135
Member Avatar for anthony5557

[quote] vc++ is not a compiler, its an IDE. Your compiler is most likely MingW. [/quote] No, Visual Studio/VC++ Express has its own compiler. If you are using an IDE such as code::blocks or Dev-C++ that comes with mingw in some cases then that will likely be your compiler. @OP …

Member Avatar for jonsca
0
161
Member Avatar for oxy77

[quote]I keep getting "program has exited with code 0"[/quote] This is referring to value sent back via the "return 0;" at the end of main not to any result in your program. In the past (and probably still currently)people have used different error codes to signify different events causing the …

Member Avatar for oxy77
0
97
Member Avatar for Eternity[LK]

Could your professor have meant something like disabling them as well? That was the first thing that came to my mind, but maybe that's oversimplifying it a bit.

Member Avatar for Geekitygeek
0
2K
Member Avatar for begineer_26
Member Avatar for webdragon89

[quote]Firstly use int main [/quote] ...because it's complying with the standard and won't compile on many modern compilers [quote]there is no builtin function for two objects of //the same class to talk to each other [/quote] This is not true. It's a bit counterintuitive but objects of the same class …

Member Avatar for Nick Evan
0
275
Member Avatar for wendell_

He means when you declared [icode] area_tiles [/icode] I think it might be the parens you have after t. You don't need them when declaring an object by the default constructor. Just do [icode] Tile t; [/icode]

Member Avatar for mitrmkar
1
116
Member Avatar for dude1

Try this: [code] #include <sstream> string filename; stringstream ss; cin >> filename; ss<<filename<<".dat"; outFile.open(ss.str().c_str()); [/code] The first str() gets the string from the string stream and the c_str() you already know. (fill in the name of your own output file for outFile) After further consideration I'm not sure why CP's …

Member Avatar for dude1
0
98
Member Avatar for tquiva

Up on line 33 initialize it to zero ([icode] int JOG_min_total = 0; [/icode]). Trace it out, the first time you're going through the loop you're getting JOG_min_total = JOG_min + (whatever garbage is in this variable at the start). So if you set it to zero you'll get the …

Member Avatar for tquiva
0
97
Member Avatar for neigyl_noval

This may sound like a silly question but did you try hitting ALT-Enter while it's running? I don't know much about the specifics but from what I've seen on here the later the windows version the less it's compatible with the BGI. I don't think the compiler itself will even …

Member Avatar for neigyl_noval
0
317
Member Avatar for clutchkiller

I know you said it's solved but just to clarify for you. Dividing 2 integers gives an integer result (0) which is then assigned to the double. You found the solution already.

Member Avatar for clutchkiller
0
109
Member Avatar for ruin

[noparse][code] //code goes here[/code][/noparse] (akin to an HTML tag but with [] instead) or you can highlight your code in the editing box and click on the [code] icon in the toolbar. Look at the writing on the background of the Quick Reply box. It's also in the documentation when …

Member Avatar for jonsca
0
112
Member Avatar for corby

It looks ok. I'm confused as to why you are incrementing and decrementing playerTurn in the branches of the if.

Member Avatar for corby
0
140
Member Avatar for akssps011

I'm assuming you're doing this for Windows? Have you had any experience with any of the GUI toolkits? I could rattle them off but there's probably a list on the site somewhere. Ok some examples anyway: MFC, .NET/Winforms (C++/CLI), Win32 API, third party ones like wxWidgets, Qt, you name it. …

Member Avatar for WaltP
0
173
Member Avatar for JamesGeddes

I was able to read "COMPLETE" through the following: [code] string fileline; HttpWebRequest reqFP = (HttpWebRequest) HttpWebRequest.Create("http://jamesgeddes.com/wttr.txt"); HttpWebResponse rspFP = (HttpWebResponse)reqFP.GetResponse(); Stream st = rspFP.GetResponseStream(); using (StreamReader sr = new StreamReader(st)) { fileline = sr.ReadLine(); } [/code]

Member Avatar for jonsca
0
249
Member Avatar for superdhebz

Change line 29 to: [code] if(i !=num) cout << "(" << num-i << ")" << ""; [/code] Or better you could set factorial to num in your function and change your loop to go from [icode] for(i = num-1;i>=1;i--) [/icode] and only display i.

Member Avatar for superdhebz
0
756
Member Avatar for newcuser

Variables must be declared at the top of the block. Move your declaration above the printf statement. Also, you have an extra semicolon on line 61(EDIT: Though that seems to pass through ok, I guess it's optional).

Member Avatar for mitrmkar
0
405
Member Avatar for makan007

It's a guard against including the information in the header file more than once(which can cause a mess with redeclarations etc.). You'd put the contents of your header between lines 2 and 3. At first pass if this symbol Test_h is not defined, processing goes to line 2 which defines …

Member Avatar for jonsca
0
144
Member Avatar for tquiva

Looks like you have a space after your / and before your * -- it won't parse the comment correctly like that so it's trying to evaluate your comment as a statement.

Member Avatar for jonsca
0
124
Member Avatar for dls_20022002

bookNumber is an array of char, you're trying to compare it to one single char. You can either make both of them std::string or put '1' into a char array and use strcmp.

Member Avatar for jonsca
0
627
Member Avatar for Jalwes
Member Avatar for jonsca
0
132
Member Avatar for babyd_
Member Avatar for amia

Give this a read: [url]http://www.daniweb.com/forums/announcement8-2.html[/url] [quote]write a c program[/quote] Also, this is the C++ forum.

Member Avatar for jonsca
0
44
Member Avatar for karolik

Just to add one quick thing: use a while loop instead so that you can exit when you have 100 numbers not just when you've gone through the cycle 100 times (I suppose you [I]could[/I] rework your for loop to accomplish the same thing too but it might be more …

Member Avatar for jonsca
0
118
Member Avatar for Martje

[icode] textBox1->Lines = gcnew array<String^> {"Success"}; [/icode] is the command that you need. Buried in the MSDN entry for Lines I found the following: [code] Note: By default, the collection of lines is a [B]read-only[/B] (my emphasis added) copy of the lines in the TextBox. To get a writable collection …

Member Avatar for Martje
0
433
Member Avatar for msr

I think you just need the SuppressKeyPress member of the EventArgs, so simply placing [icode] e.SuppressKeyPress = true;[/icode] on line 3 should work.

Member Avatar for jonsca
0
512
Member Avatar for jonsca

I have a feature suggestion, since I know you are nothing short of super ultra busy or anything :P I use the Previous Thread / Next Thread links at the bottom of the page of posts all of the time, but I'd like to be able to do the same …

Member Avatar for jonsca
0
311
Member Avatar for corby

Out of curiosity, why do you create another tic-tac-toe object within the tic-tac-toe class? To call the methods of the other class just instantiate it: [code] MyOtherClass myinstance; myinstance.methodNeeded(); [/code] (since you don't need pointers in this case you can put that on hold for a while)

Member Avatar for WargRider
0
675
Member Avatar for spidersp00ks

Ok. Looks like you're on the right track (you could even make ListNode a subclass of List). So now just come up with some methods for accessing the elements. A trick that might help you along is that nothing in your requirement said that this has to be a linked …

Member Avatar for jonsca
0
91
Member Avatar for fender177

Check out [URL="http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/129a9d68-fa73-4d7e-ae12-182f562afedc"]this thread[/URL] on MSDN.

Member Avatar for jonsca
0
73
Member Avatar for aswin cp

Once you have a new Fibonacci number use another small loop to go from the previous Fib number until the current one. Record/output those values that you find.

Member Avatar for mrnutty
0
1K
Member Avatar for KRal

You should call srand() only once and in main() before you call the methods that use rand(). What problems are you having with the output? Can you determine (using cout statements) where the data are getting lost?

Member Avatar for jonsca
0
114
Member Avatar for tennis

char * is a C style string (versus a std::string in C++), also a pointer to char (related to them being considered arrays of char). C strings must be null terminated (that is end in the character '\0') and they are immutable (you can't change a character while leaving the …

Member Avatar for jonsca
0
140
Member Avatar for HoldmysunnyD

For templates the declaration and implementation must be kept in the same header file (see [url]http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12[/url]) only a few compilers can handle the export keyword to make this possible and I don't believe VC++ is one of them.

Member Avatar for HoldmysunnyD
0
963
Member Avatar for DoEds

I don't think you really need structs for this. If you've covered arrays, strings, and string functions like strcmp and strcpy you should be all set. Rather than keeping a count with the item, keep a count in an int array (match up the indexes with those of your strings),

Member Avatar for WaltP
0
111
Member Avatar for skorm909

Congrats on making a decent effort on what we had talked about in the other thread. [I]However:[/I] [code] array monster [level 1 , 100 health]; damage ++ 1-10; [/code] you're still making up syntax as you go. It would be the equivalent of me walking up to you to have …

Member Avatar for skorm909
0
417
Member Avatar for techie929
Member Avatar for tquiva

I got it to run fine as is on my machine: [code] Enter the first input (EOF to end): 10 Enter the next input (EOF to end): 10 Enter the next input (EOF to end): 10 Enter the next input (EOF to end): 30 Enter the next input (EOF to …

Member Avatar for biswajit_cs07
0
122

The End.