2,839 Posted Topics

Member Avatar for manavsm

First: Learn how to use [URL="http://www.daniweb.com/forums/announcement8-3.html"]codetags [/URL]when posting code here. It makes your code easier to read. Without reviewing all of your code, I did notice one problem: [code] .... scanf("%d",&ch); { case 1: .... [/code] I suspect that you mean something like: [code] ... scanf("%d",&ch); switch(ch); { case 1: …

Member Avatar for yellowSnow
0
1K
Member Avatar for johndoe123

Here's how to do it: [code=cplusplus] int choices[2] = {2,3}; //choose between 2 and 3 // Seed the random generator with srand() // Use rand() to pick either 0 or 1 and store in variable x int L = choices[x]; [/code] Google for srand() and rand() to find out how …

Member Avatar for Nick Evan
0
10K
Member Avatar for Vallnerik

[QUOTE=Vallnerik;994913] The reason I ask this, is because my constructor is very large and I have like 40 variables in the constructor initialization list. I'm just wondered if this is a common occurrence in games or in other large applications? Or is my class too bloated?[/QUOTE] 40 members are a …

Member Avatar for mrnutty
0
130
Member Avatar for nida afaq

If your teacher taught you this, (s)he should be fired. [URL="http://www.gidnetwork.com/b-66.html"]void main[/URL] [URL="http://www.cplusplus.com/forum/articles/10515/"]clrscr[/URL] And use cin.get() instead of getch(); It's a non-standard function. Also update your Turbo compiler to something from the last 10 years by downloading [URL="http://www.codeblocks.org/downloads"]code::blocks[/URL] (free) Now for your question: There's no way to know what the …

Member Avatar for kvprajapati
0
140
Member Avatar for erialclaire_238

[QUOTE=erialclaire_238;987719]I'm having a problem on this one. using a for loop i need to make a user guess a number from 1-10 with only three tries,,, the correct number is 3 . It's running and all but it keeps showing the cout 'Your password is correct' & Program Over everytime. …

Member Avatar for erialclaire_238
-2
1K
Member Avatar for Talguy

You're not checking if your file is indeed open en ready for reading, so change this: [CODE=cplusplus]if(!fin) {[/CODE] to: [CODE=cplusplus]if(!fin.is_open() || !fin.good()) {[/CODE] Then change this: [code=cplusplus] while(!fin.eof()) { // Get the current line of the document getline(fin, programLine); // error occurrs here [/code] with this: [code=cplusplus] while(getline(fin, programLine)) { …

Member Avatar for Talguy
0
118
Member Avatar for markrezak

I'm wondering: Why did you, again, post code without using [URL="http://www.daniweb.com/forums/misc-explaincode.html"]code-tags[/URL]? William Hemsworth specifically asked you in post #2? Also: marking your thread 'solved' when you still have a question won't get you replies. You should start a new thread with your new question. And this time use code-tags when …

Member Avatar for markrezak
0
188
Member Avatar for evilguyme

So what was wrong with using [URL="http://www.daniweb.com/forums/thread224570.html"]ShellExecute[/URL]?

Member Avatar for evilguyme
0
80
Member Avatar for lostmonkey

you should change [icode]filereader.readFileInformation(filename.c_str());[/icode] to: [icode]filereader.readFileInformation(filename);[/icode]. Your function expects a std::string, so no need to convert it to a char array first. Because you do that here: [icode]infile.open(filename.c_str(), ifstream::in);[/icode] Next time use [URL="http://www.daniweb.com/forums/misc-explaincode.html"]code-tags[/URL] when posting code.

Member Avatar for Nick Evan
0
85
Member Avatar for Gaiety

Can't explain it as good as Narue does [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_avl.aspx"]here[/URL], so you should take an hour or two to read the article. Everything will be clear afterwards :)

Member Avatar for Barefootsanders
0
137
Member Avatar for evilguyme

How about: [CODE]std::string message = "Error "+ name + " sucks"; MessageBox(NULL,message.c_str(),"error",MB_ICONEXCLAMATION);[/CODE]

Member Avatar for Nick Evan
0
102
Member Avatar for samm22

did you seed the random-generator with srand() ? Something like: [code=cplusplus] srand(time(NULL)); cout << rand()%v.size(); [/code]

Member Avatar for samm22
0
144
Member Avatar for evilguyme

Here's a [URL="http://www.codeguru.com/forum/archive/index.php/t-403977.html"]thread [/URL]on the conversion. Can't test it because I don't use managed code.

Member Avatar for evilguyme
0
482
Member Avatar for evilguyme

Here's a [URL="http://www.cplusplus.com/doc/tutorial/files/"]tutorial[/URL]. Read it, and come back when you have questions/difficulties.

Member Avatar for evilguyme
0
172
Member Avatar for Darth Vader

[QUOTE=Darth Vader;993195]I am about to convert this 2D vector to managed code where I instead will use a List<String>. The problem is that I dont know how to do that, I would be happy to see how that could be done.[/quote] Short answer: you can't. Vectors and Lists are both …

Member Avatar for Darth Vader
0
1K
Member Avatar for calleriq

[QUOTE=calleriq;992913]Thank you everybody, I got it,[/quote] I cannot imagine that the above code would compile. One thing I spot is that you write [icode]while[/icode] with a capital W (While). That won't compile for example. Also: [URL="http://www.gidnetwork.com/b-66.html"]void main[/URL] [QUOTE=calleriq;992913]thanks god[/QUOTE] So did God give you working code then? :icon_wink:

Member Avatar for Nick Evan
0
151
Member Avatar for scantraXx-

I have removed your empty() function because it made no sense at all. It's no different form the empty() function that a std::vector has. I also included: [icode]#include <algorithm>[/icode] because it is required for "max_element", "find" etc. I also fixed your warnings. I've put in comment what I've changed and …

Member Avatar for Alex_
0
165
Member Avatar for iorgobus1
Member Avatar for Wolf CCMLG

Your compiler isn't lying. You didn't delcare a, b,c or d here: [code] int main(void) { DivSales divSales; divSales.addTotal(a,b,c,d); [COLOR="Red"]// <--- here[/COLOR] [....] [/code] You should call the function with either numbers, or declare a,b,c,d: [CODE=cplusplus] int main(void) { DivSales divSales; divSales.addTotal(1,2,3,4); // with numbers divSales.printValue(); cin.get(); }[/CODE] [I]or[/I] [CODE=cplusplus] …

Member Avatar for Wolf CCMLG
0
207
Member Avatar for Nick Evan

I might have an idea how to get newbies to use code-tags: Why don't you replace the (rather vague)[B] #[/B] symbol in the replybox with the word "code" or "code-tags". Some other forums I visit have this and it appears that they have a better newbie/codetag ratio :)

Member Avatar for Dani
0
208
Member Avatar for daviddoria

[QUOTE=daviddoria;989341]I guess it was a gdb bug? I compiled the latest svn and it gets past that line now with no problems.[/QUOTE] [I]Or[/I] it's undefined behavior, which will run in 99% of the cases (for example) and crash in 1%. Show the line of code directly after the line you've …

Member Avatar for Nick Evan
0
3K
Member Avatar for rajesh.hck

[QUOTE=oop'stechie;988893]well u can download it from the net[/QUOTE] You mean like the the link Salem posted in post #2? :icon_wink:

Member Avatar for dgr231
0
102
Member Avatar for samm22

[QUOTE=samm22;988931]HI Jason, I liked your stuff. Cool. But I think I found a simpler way : [/QUOTE] You're very close, but an even better way to do it is like this: [code=cplusplus] vector<int> vect; /* Do stuff with vect */ vector<int>::iterator iter_max = max_element(vect.begin(), vect.end()); cout << "Max is: " …

Member Avatar for JasonHippy
0
105
Member Avatar for cwarn23

[QUOTE=cwarn23;988614]I didn't realise that Cscgal was the one in charge of daniweb. Thanks for that information and the green light it is.[/QUOTE] So you missed: - Her title: "The Queen of DaniWeb" - Her badges: "Administrator" and "Staff writer" - And her signature saying "Dani the Computer Science Gal" as …

Member Avatar for Nick Evan
0
364
Member Avatar for Ancient Dragon

I always keep a list of links that I frequently use on Daniweb. This is not the first time a useful feature is no longer linked to, although it still exists :) . Here you go: [URL="http://www.daniweb.com/forums/search.php"]http://www.daniweb.com/forums/search.php[/URL]

Member Avatar for Nick Evan
0
67
Member Avatar for suutukil

You need to learn the [URL="http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx"]art of sorting[/URL]. Come back when you have tried something and have a more specific question.

Member Avatar for suutukil
0
623
Member Avatar for ticktock

[QUOTE=minigweek;987049]Close. But still it will give wrong output. I will drop a hint. [code] for(int i=0;i<=5;i++) { //something goes in here... } cout>>i; [/code] guess what is the output of i ?[/QUOTE] I'll take a guess: Compiler error. :icon_wink: You probably meant: [icode]cout [B]<<[/B] i;[/icode]

Member Avatar for ticktock
0
142
Member Avatar for swinefish

[QUOTE=Rashakil Fol;987109]Fail it and you're on the road to having nothing to do with your life other than moaning at people on Daniweb about their futures?[/QUOTE] So what exactly are [I]you[/I] doing here? :)

Member Avatar for Nick Evan
0
170
Member Avatar for Samyx

[QUOTE=Samyx;985803]I am having a problem with my global array, it says that is not declared or something, I don't think the program is recognizing its size. How can I declare a global array without identifying its size?[/QUOTE] You should (almost) never use global variables. It's very dangerous to do so! …

Member Avatar for VernonDozier
0
174
Member Avatar for sknake

[QUOTE=Ancient Dragon;985389] I changed mine just yesterday with no problems.[/QUOTE] That's not at all how I thought you looked :) Nice dog.

Member Avatar for Dani
0
169
Member Avatar for ddanbe

PRO: - I really like the 'edit history' functionality :) - DW is a lot faster . - the new profile page has is a lot clearer then the old one. - snippets and tuts are integrated better in the forum CONS: - I'm not sure I'm a big fan …

Member Avatar for DdoubleD
0
365
Member Avatar for icu222much

[QUOTE=icu222much;985512] I then went to File --> New --> File and selected C++ File (.cpp). I then saw a blank screen for me to type my code so I entered in my Hello World program. I went to Build --> Build Solution and again I have the same error.[/QUOTE] It's …

Member Avatar for hao001
0
207
Member Avatar for xfreebornx

You really aren't the sharpest knife in the shed are you? Why don't you listen to good advice [URL="http://www.daniweb.com/forums/post960283-5.html"]when someone gives it to you[/URL]?

Member Avatar for hao001
0
320
Member Avatar for and12

If you find this insulting: [QUOTE=javaAddict;966439]The only bug I see is you accusing a programming language which has been around for decades, used by thousands, for your incompetence.[/QUOTE] Then you should be lucky you didn't ran into me in the C++-forum :icon_twisted: My advice would be to grow up. Whining …

Member Avatar for ~s.o.s~
-2
465
Member Avatar for scrypt3r

[QUOTE=marco93;985632]... and [B]wrong [/B]code ...[/QUOTE] Why? For once, tell us [I]why [/I]you think this code is wrong instead of leaving a piece of sh*t comment and then run and hide when you get a reply.

Member Avatar for William Hemsworth
0
167
Member Avatar for Ultratermi

I think you mean: [icode]double out = atof(in.[B]c_str()[/B])[/icode] instead of [icode]double out = atof(in.data())[/icode]

Member Avatar for Ultratermi
0
137
Member Avatar for xfreebornx

[QUOTE=xfreebornx;985764]please can u write it in a sample program for me because i don't understand what u meant......[/QUOTE] Yes I could. But the real question is: what don't you understand from what Ancient Dragon told you? What have you tried? Show some code and tell us what the problem is. …

Member Avatar for VernonDozier
0
105
Member Avatar for kaninelupus

[QUOTE=William Hemsworth;984316]Donate :)[/QUOTE] [I]Or[/I] be a member since the time that animated-avatars were still allowed and never change it, like I did. (yes it [I]is[/I] animated) :)

Member Avatar for lllllIllIlllI
-2
215
Member Avatar for Salem

Don't know if it's a bug or not, but I'm allowed to edit tags on threads. I don't even know what it does, but it looks like something only mods are allowed to do :)

Member Avatar for MosaicFuneral
1
984
Member Avatar for MattyRobot

[QUOTE=MattyRobot;982595] the code I wrote I had included all the things you mentioned and still didn’t work. the function had a prototype and the class had a semicolon. but the compiler said that the function was not declared in the scope. [/QUOTE] You could also post the [I]actual[/I] code here, …

Member Avatar for rughead
0
158
Member Avatar for JETFUSION

[QUOTE=Tom Gunn;982618]It only sounds easy because we have learned by making the same mistakes before. I still mistype counters all the time, so I know how to find it and prevent it. ;)[/QUOTE] Exactly. One of the other typos I still make now and then is : [icode]if (a[COLOR="red"]=[/COLOR]1)[/icode] versus …

Member Avatar for tux4life
0
127
Member Avatar for Thomasedicel

What have you done so far? Here's tutorial on [URL="http://www.cprogramming.com/tutorial/lesson5.html"]switch statements[/URL]. Read it and try to start for yourself. Then come back with a specific question.

Member Avatar for mrnutty
-1
127
Member Avatar for octavia

You mean something like: [code=c] unsigned char a = '0'; unsigned int b =a; [/code] 'b' will now be 48. That's the [URL="http://asciitable.com/"]ASCII[/URL]-value of '0' (zero)

Member Avatar for ithelp
0
159
Member Avatar for GooeyG

[QUOTE=ithelp;980334]That code will not compile[/QUOTE] First : DdoubleD was pointing out a flaw, he wasn't giving a suggestion. Second: Why wouldn't this compile?

Member Avatar for DdoubleD
0
168
Member Avatar for Peter_APIIT

You should change: [code] #include "cv.h" #include "highgui.h" [/code] to: [code] #include <cv.h> #include <highgui.h"> [/code] also check manually if the file [icode]C:\Program Files\OpenCV\bin\highgui110.dll[/icode] exists. If it does: re-install openCV Next time you post: use [URL="http://www.daniweb.com/forums/misc-explaincode.html"]code-tags[/URL]. Also bumping your thread is considered very rude and you're lucky I'm in a …

Member Avatar for Salem
-1
361
Member Avatar for Behi Jon

[QUOTE=Behi Jon;980208] For example, look at this codes : [..code..] What it say ?[/QUOTE] It declares an int-array and loads it with values. The array is const static which means that the values in the array cannot be changed. The second line of code declares a static unsigned char array …

Member Avatar for Nick Evan
0
272
Member Avatar for Behi Jon

[QUOTE=Behi Jon;980221]I don't want the code; Just a guidance like this : [B]You can use recursive functions[/B][/QUOTE] Ok. --> [B]You can use recursive functions[/B] Also: Loops.

Member Avatar for Nick Evan
0
158
Member Avatar for networkmancer

[QUOTE=networkmancer;979480]And sorry but IM ******** New to C++. And its compiler btw is Turbo C++. Its ancient. Thank you. Please stick to the topic. Im new to C++ and knows nothing.[/QUOTE] So you think bashing on a respectable regular is going to help you with your question? I don't think …

Member Avatar for Ancient Dragon
0
242
Member Avatar for jBat

You're using try and catch, so that's a good thing. How and where you throw and catch is also a matter of personal taste. Some people (like me) try a small piece of code and catch if something goes wrong. Some other people just wack their code in one big …

Member Avatar for Nick Evan
0
152
Member Avatar for Brian.oco

[QUOTE]Goolge Draws Ire of Privacy Advocates -- Part I [/QUOTE] Goolge?? The rest was good reading! regards Niek

Member Avatar for happygeek
0
215

The End.