2,827 Posted Topics

Member Avatar for mrnutty

Here's mine. Haven't tested it with anything but the posted file, but got the right answer. [code] #include <iostream> #include <fstream> #include <vector> using namespace std; struct Triangle { int peakVal, triangleVal; }; void usage() { cout << "Usage : ./Triangles filename"; } int max(int num1, int num2) { if …

Member Avatar for iamthwee
0
138
Member Avatar for avarionist

[QUOTE=avarionist;]4 characters are numbers that represent North south east and west respectively the other 4 characters are delimiters(i don't know why i put them in maybe for easier reading?)[/QUOTE] No, it makes for more difficult reading. If the file format is one that you created yourself, you are better off …

Member Avatar for avarionist
0
156
Member Avatar for The Founder

As a side route venture back onto the original rule-breaking, which would have been the actual topic had the posts not been so ridiculous, what exactly is a "fake" signature and why is it a problem/against the rules? I gather that it is an e-mail address WITHIN an actual post …

Member Avatar for VernonDozier
-5
171
Member Avatar for rroky

[QUOTE=rroky;593933]Please any one can help at this problem I have with javac. I have download the java jdk1.5.0_15 at least 20 times in three (3) machins and it do not compile. Actualy it can not read the file. Javac is installed and is on bin, when I type javac it …

Member Avatar for divya bangroo
0
1K
Member Avatar for ASardinia1

Maybe when you see a line like this: [code=C++] cout << "*"; [/code] replace it with this? [code=C++] cout << MyCharacter; [/code]

Member Avatar for regnerz
0
423
Member Avatar for andyg55

You don't need to zero out the array. You already know the size (5 x 3), so declare it that size: [code] int matrix[5][3]; [/code] i would just read it in like this: [code] for (int i = 0; i < 5; i++) { for (j = 0; j < …

Member Avatar for tagazin
0
2K
Member Avatar for timbomo
Member Avatar for Fbody
0
1K
Member Avatar for flaviusilaghi

Define "bad pointer". This line is fine and will give you a perfectly good pointer to an array of 16 pointers to characters. [code] unsigned char** intext=new unsigned char* [16]; [/code] Note that it allocates absolutely no characters. So unless you something else between the line above and this line: …

Member Avatar for VernonDozier
0
147
Member Avatar for spartan118

[QUOTE=spartan118] Also, I've attached the two main files of my program. [/QUOTE] Why do you have two main functions? That's going to screw everything up. Besides that, make sure you have #ifndef guards in your header files. If you try to define something twice, it screws the linkage up, so …

Member Avatar for VernonDozier
0
267
Member Avatar for esdel

[QUOTE=esdel;1249168]Sorry folks but after 30 minutes this is the ONLY place I can find to ask a question. It is a VERY elementary question! Can you please explain to me about "who I am" as regards emails and how other people regard me? For example I have emailed using SNIP, …

Member Avatar for VernonDozier
0
92
Member Avatar for D boss

Code tags and formatting please. All your errors appear to be due to the fact that you refer to a ThreadPanel class, but you do not provide one so it doesn't know what to do when it sees the word ThreadPanel in your code.

Member Avatar for Zwien
0
1K
Member Avatar for cl2020

Your check function only returns -1 no matter what. Is that what you want?

Member Avatar for VernonDozier
0
96
Member Avatar for hatzi8

[QUOTE=hatzi8;1244336]Hi, i've have just created my first program in visual c++ 2008 express edition and i'd like to know, if I can create an exe file to make this program run independently from visual studio. thanks[/QUOTE] Absolutely. Once the .exe file is created, the program no longer needs Visual Studio. …

Member Avatar for VernonDozier
0
85
Member Avatar for bree9482

[QUOTE=bree9482]Hi guys hope ur are all well! I have a program im trying to finish and its not going well. I am quite new to C++ and am not the greatest. I have code that ill post, but the problem is when i run the program with the readfile(); function …

Member Avatar for VernonDozier
0
151
Member Avatar for j-green.10

[code] std::ifstream stm; stm.open("str100"); double d; stm >> d; [/code] If you have a file called "str100" with a double in it, this is how you could read that double into the variable d. You had it fine except for the second line. I'm not sure what you were trying …

Member Avatar for VernonDozier
0
146
Member Avatar for Biker920

[QUOTE=cscgal]That's why you should use both. :-P When you use DaniWeb's built-in mechanism, the ad server is never contacted. The added bonus is that things on the site are more streamlined, such as the right area of the first post in a thread going away and the problem that you …

Member Avatar for diafol
0
250
Member Avatar for ayan2587

This is a math problem, first and foremost, more than a computer science problem. As you correctly mentioned, you don't want to calculate n^n. Even if you could use BigInteger (and you may be able to), I imagine that misses the point of the math problem, which is that you …

Member Avatar for ayan2587
0
204
Member Avatar for Ancient Dragon

> How can I use code tags that do not produce line numbers? I used to use quote tags, but that is just almost unusable now since the quoted text is hidden. So to preserve the spacing I use code tags, but I don't like the line numbers. > > …

Member Avatar for diafol
0
223
Member Avatar for Curt1337

I don't see the word "new" or the word "malloc" or the word "calloc" anywhere in your code, so it doesn't look like you are creating a new array anywhere that won't go out of scope once it leaves the function. That's one problem, even if you had set the …

Member Avatar for Curt1337
0
320
Member Avatar for debugger09

[QUOTE=debugger09;1234631]thanx for the reply [B]daviddoria[/B] will it work on DEV C++ ?? i think the program runs only on linux platform i not able to understand the code :(([/QUOTE] It's Boost, so you have to download/install it and play around with it. It's not part of the C++ standard, but …

Member Avatar for debugger09
0
153
Member Avatar for drt_t1gg3r

[QUOTE=drt_t1gg3r]All of the data is copied except the container data.[/QUOTE] What do you mean by the "container data"? [QUOTE=drt_t1gg3r] Now all of the Gets/Sets are appropriate to the data members. one returns a copy of the value, and one sets the value to an amount of the correct type.[/QUOTE] Normally …

Member Avatar for ifezuec
0
211
Member Avatar for scream2ice

You want to use String.split. Use white space as the delimiter. That'll split your big String into three smaller Strings. Then you can use parseInt. [url]http://java.sun.com/javase/6/docs/api/java/lang/String.html#split%28java.lang.String,%20int%29[/url] Lots of good samples out there. Google "Java string split example".

Member Avatar for Abdel_eid
0
246
Member Avatar for tinanewtonart

Lots of problems before even touching the polymorphism part. Read the compiler errors. Some will tell you exactly what the problem is. Some are more cryptic. [LIST=1] [*]Any non-void function should have a return statement. [*]Function calls should not have the type in it (i.e. leave "char" out of the …

Member Avatar for tinanewtonart
0
1K
Member Avatar for jephthah

[QUOTE=cscgal] The idea behind this is that if you're just directly quoting another post, it gets hidden by default, because it adds no new value to your post.[/QUOTE] It does add new value to your post and possibly their post because it can emphasize a particular point that you are …

Member Avatar for Ezzaral
5
514
Member Avatar for carrythe1

[QUOTE=carrythe1;1230375]thanks - i'm familiar with SWITCH but isn't this just a way of simplifying many IF statements? I still don't know how i would, for example, get the program to use the following logic: <run code and get to input decision point> <pause main program and wait for input> if …

Member Avatar for nbaztec
0
2K
Member Avatar for jephthah

[QUOTE=cscgal] Because I don't want to have to scroll past 50 lines of something that I just finished reading every single time someone uses the "Post Reply" button and quotes the previous post ... Hence hiding is the default when using the Post Reply button. then that actually is more …

Member Avatar for diafol
3
1K
Member Avatar for drt_t1gg3r

[QUOTE=drt_t1gg3r;1228041]Well I did a work around. Instead of having the (2) functions in the PERSON class, I put them in each of the PLAYER, COP, and ENEMY classes and everything linked fine. I wonder if it's a Dev-C++ IDE thing. I can't understand why I can't have the (2) functions …

Member Avatar for VernonDozier
0
214
Member Avatar for unity

[QUOTE=unity;687610]hi i want some good question c/c++ for practice can anyone suggest me some website or any good book[/QUOTE] See the sticky at the top of the C++ forum for both books and practice problems: [url]http://www.daniweb.com/forums/thread67837.html[/url] [url]http://www.daniweb.com/forums/thread70096.html[/url]

Member Avatar for suze_eq
0
156
Member Avatar for Stevishere

[QUOTE=The Dude;1189292]Well i understand your point but IT IS A WAY TO BRING NEW MEMBERS ASHORE :) It shouldnt be as obtrusive though and maybe Dani could look into it :) Nice to see you posting BTW :)[/QUOTE] You're missing the point. He has one post and probably never even …

Member Avatar for Nick Evan
0
365
Member Avatar for Sandhya212

You could typecast your return type to explicitly return an int**, which would make it compile, but it still wouldn't run right. I'm guessing that you int** does not dereference correctly from a 2-D array to a 1-D array. arr2d may know it's a 2-d array and thus **arr2d and …

Member Avatar for Sandhya212
0
459
Member Avatar for Leppie

[QUOTE=Leppie]didn't like the "mr = mr + temp" and thought there might have been a better way to do this?)[/QUOTE] [code] mr += temp; // equivalent to your code above[/code] [code] mr = mr + temp; //adds 1 to male population fr = fr + temp; //adds 1 to female …

Member Avatar for Leppie
0
115
Member Avatar for jephthah

I rely on the big orange negative rep flags and the negative votes to alert me to people I should be wary of helping. That and the avatars zone me in pretty fast. All three seem to be missing now. You have to click on the thread now and then …

Member Avatar for Dani
8
2K
Member Avatar for BestJewSinceJC

The whole thing is screwy in my opinion. There's tons of people who work very hard for little money who don't get tips. Does the guy cooking the burgers at Burger King work less hard than the guy cooking your meal at a 5-Star restaurant? Does the guy who wipes …

Member Avatar for avatar103
0
657
Member Avatar for jimJohnson

[QUOTE=jimJohnson] There is a chance I have no idea what I am doing so just thought that I could just at least start with something[/QUOTE] Compile it and find out for sure whether you have any idea of what you are doing. Report the errors in your post. Does it …

Member Avatar for iamthwee
0
172
Member Avatar for jimJohnson

[QUOTE=jimJohnson;1221753]I am working on another linked list problem...really been struggling with this chapter dealing with lists...Here is the instruction for this example... Write an algorithm to search a linked list with the first node pointed to by first for a given item and, if the item is found, return a …

Member Avatar for VernonDozier
0
98
Member Avatar for Rashakil Fol

[QUOTE=ardav;1159739] I quite fancy the female native - I'm not sure if I'm supposed to.[/QUOTE] You're supposed to. Trust me, you aren't the only one.

Member Avatar for Diamonddrake
1
323
Member Avatar for Martje

[QUOTE=Martje;1220452]I am trying to make a list of array pointers, Is there a way that after declaring an array i can adjust the size? For example at start i create a array called : "list[2]" Is there a way that later on i can change "list[2]" and make it "list[3]" …

Member Avatar for VernonDozier
0
173
Member Avatar for Leppie

I have a few code snippets that may or may not be of use. I'm not entirely sure what your goal is: [url]http://www.daniweb.com/code/snippet217346.html[/url] [url]http://www.daniweb.com/code/snippet217217.html[/url] I don't know what a trap or a dungeon crawl is. I also don't know what 0 or 1 represents in this array. Is this some …

Member Avatar for Leppie
0
115
Member Avatar for NathanOliver

If you have a void function and you want to "return" (i.e. don't execute the code after that line), I'd say your best bet is to break it into two lines: [code] PrimeFactorize(number / 2, factors); return; [/code] That gives you the same "short-circuit" options that a regular "return" gives …

Member Avatar for NathanOliver
0
134
Member Avatar for Dave Sinkula

[QUOTE=sneekula;614747]I find the amount of people I meet that simply won't vote for Obama because he is half black alarming. There are also many people that have read the republican smear-mail and believe he is a muslim. Bigotry is live and well in this country![/QUOTE] Does anyone have any idea …

Member Avatar for jephthah
0
6K
Member Avatar for jimJohnson

[QUOTE=jimJohnson;1218024] [CODE] standardDeviation = sqrt (((pow(totalScores, 2.0)) - ((1.0/count) * (pow(totalScores,2.0)))) / (count - 1.0)); [/CODE][/QUOTE] Look at the formula. See if it's correct. If you don't understand the standard deviation formula, stop and do a few by hand. Whenever a compound formula goes wrong, you need to split the …

Member Avatar for VernonDozier
0
2K
Member Avatar for vihrao

I don't know what the rest of your program looks like, but consider and run this program: [code] #include <iostream> #include <cstdio> using namespace std; class matrix { public: int a; matrix (); matrix (int a); matrix (const matrix & m1); ~matrix (); matrix b (matrix c); matrix operator + …

Member Avatar for VernonDozier
0
497
Member Avatar for Atlanticspace

Pick whatever sort you want to use to sort integers (you have chosen merge sort). Presumably you have this data stored in a struct/class and you have an array of this type. Your ==, < and > comparison operators for this struct/class will be based on this first element. You'll …

Member Avatar for VernonDozier
0
110
Member Avatar for prodstar

[code] ifstream[COLOR="Red"].[/COLOR]charge("shippingcharges.txt"); [/code] Replace the dot with a space. [code] ifstream charge("shippingcharges.txt"); [/code]

Member Avatar for jonsca
0
195
Member Avatar for Atlanticspace

When reading an integer with scanf or fscanf, you need to provide it with the address of an integer. You have NEW defined as an array of size 1 (why not just a plain old single object?), so you want to dereference it, then specify which data member, then give …

Member Avatar for VernonDozier
0
155
Member Avatar for coding101

Use code tags. [noparse] [code] // code here [/code] [/noparse] What's the question? One thing that jumps out is that you are passing variables by value to a void function, changing those variables inside the function, then exiting the function, which does nothing. You need to either pass by reference …

Member Avatar for VernonDozier
0
106
Member Avatar for melteddashboard

I suggest approaching the problem in the following organized manner. You want to see where it first breaks. Thus if the error shows up in, say the Search routine, that may not mean the Search routine is incorrect. It may mean that the Insertion routine is incorrect. Presumably you have …

Member Avatar for VernonDozier
0
436
Member Avatar for Rob E

[QUOTE=Rob E;1213343]Thank you for helping. The "//" came over by mistake. My biggest mistake is(please forgive my ignorance) I don't fully understand your answer. I thought including the [I]math.h[/I] would let us use the power function. I'm reworking the program and re-reading the chapter. I'll post it again after some …

Member Avatar for Rob E
0
446
Member Avatar for Violet_82

Your swap is incorrect. Swapping is done like this: [code] // Suppose x = 4 and y = 6 and x and y are to be swapped int temp = x; x = y; y = temp; [/code] At the end of the swap, x will equal 6 and y …

Member Avatar for Violet_82
0
253
Member Avatar for lmb004

You need code tags, formatting, and a more precise question: Best fit, worst fit? Best fit and worst fit of what? What exactly is the problem? Here's your code with code tags and formatting. It's much easier to read, though it looks better in an IDE than on here. [code=JAVA] …

Member Avatar for kvprajapati
1
3K

The End.