420 Posted Topics
Re: [QUOTE=Clinton Portis;277963]I need a little help calculating odds for a roulette game.. i'm not sure why someone would bet 1:1 odds.. to me, that just means you win your money back without making a profit[/QUOTE] No, that's not what it means. 1:1 refers only to your winnings. Whatever amount you … | |
Re: [QUOTE=jennifer911;272876]Suppose a pulse generator gives out signals as a stream and we need to count the numberr of pulses... then how do we do that.[/QUOTE] Are you actually capturing data from this device? or is it a make-believe example where you have to simulate the data capture? simulating data capture … | |
Re: IEEE 1394 is better known as Apple's "[I]firewire[/I]" - I have no idea why Windows would think its connected to something. IMHO, the best thing you can do with that adapter is leave it disabled in Device manager, unless you happen to own a device which needs it... Better still, … | |
Re: So, where's your attempt..? Look here : [url]http://www.daniweb.com/techtalkforums/announcement9-2.html[/url] | |
Re: [QUOTE=n.aggel;273685]Hi, i would like to separate the declaration of a class from the definition. i know about the [code] void aclass::a_method(){ ..... } [/code] but i dont know anything about what should be written in the header file, and how can i use it through main....:confused: sorry if am not … | |
Re: What's the configuration of the machine you are trying to ping from? One problem which jumps out immediately is that the default gateway of your wireless interface is on a different subnetwork to the IP address of the machine.[QUOTE]Ethernet adapter Wireless Network Connection: Connection-specific DNS Suffix : Ip address : … | |
Re: [QUOTE=wheelz;272556]I need some help,Here is the problem, I work for a company that lays ceramic floor tile and I need a program that estimates the number of boxes of tile for a job. [/QUOTE]Somehow I don't believe you... Why not just admit that this is your homework? One simple way … | |
Re: Both network connections work completely independently of each another (meaning that any settings you have for one connection won't apply for the other, and neither connection can "see" the other - however, since they are different networks, they must be given different IP address ranges) - so I suspect you … | |
Re: Reading from a file works the same way as reading from any other istream, such as cin: [CODE]//read up to newline std::string str; std::getline(cin, str);[/CODE] [CODE]//read up to whitespace (after a word or character) std::string str; cin >> str;[/CODE]With files, replace [I]cin[/I] with the name of your ifstream | |
Re: [QUOTE=pointers;271986]I hav no idea fnd.....pls share u r views.........[/QUOTE]Someone has already provided you with a rough outline of the program as a starting point. Perhaps you missed this on your way in..? [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: writing pseudocode and problem solving is all part of programming & software development (And if you haven't tried to write pseudocode for this problem yet, then I suggest you give it a go, and see if that helps!), so I'm not going to write a complete comprehensive solution, although, its … | |
Re: [QUOTE=reezin14;264565]I was wondering if you had a wirless connection and a ethernet connection going at the sametime how dose the computer know which one to connect to or how dose if decide(IS IT FIRST COME FIRST SERVE).:confused:[/QUOTE] It doesn't need to decide anything - You can be connected to both … | |
Re: [QUOTE=reRanger;255726]Hello: I was wondering if anyone in this forum could point me in a direction (a link) where I could find practice projects (similar to Python [URL="http://www.daniweb.com/techtalkforums/thread32007.html"]Projects for the Beginner[/URL]) dealing specifically with C++ classes and their related functions? Thank-you in advance, reRanger[/QUOTE]Why not use some of the suggestions in … | |
Re: Just a few comments, since andor has already pointed out what appears to be the main problem. [QUOTE]usingnamespace std;[/QUOTE]typo above, was that a result of colouring in the code? or didn't you copy&paste your code? as a general rule of thumb, never attempt to retype code, because typo's happen - … | |
Re: [QUOTE=champos;254373]Hi, I have a question which i have no idea how to do manage. I need to convert a string in the format like "1 234 567" so i can do some calculations on the indvidual numbers. What is the best way to do this? Thanks[/QUOTE] Are you using C++ … | |
Re: The binary-to-decimal link which Dave has given you is the 'C' way of doing things, which is fine, and you should learn to do it that way, although, C++ gives you a really nice easy way to do this - Using the <bitset> library. (a bitset is a container which … | |
Re: Your professor sounds like he's leading you up the garden path - the system() function takes one argument (a [COLOR="Blue"]const char*[/COLOR]) and returns an [COLOR="Blue"]int[/COLOR], which, in all cases i'm aware of, is purely an indicator for whether or not the call was successful (0 for success, and non-zero for … | |
Re: Since you're using C++, have you done any research into STL and the standard library algorithms? these sorts of tasks are exactly the kind of thing which the STL excels at doing - eg, [CODE][COLOR="Black"][COLOR="Blue"]#include [/COLOR]<iostream> [COLOR="Blue"]#include[/COLOR] <vector> [COLOR="Blue"]#include[/COLOR] <algorithm> [COLOR="Blue"]template[/COLOR]<[COLOR="Blue"]const int[/COLOR] N> [COLOR="Blue"]int[/COLOR] array_size([COLOR="Blue"]const int[/COLOR] (&arr)[N] ) { [COLOR="Blue"]return[/COLOR] … | |
Re: [QUOTE=VinC;248696]I'm actually not sure whether I should start with C, jump into C++ or bother learning the language at all. (mainly because of the massive time commitment) I know I will be learning C++ for the next four years in university. But I also know you shouldn't blindly accept what … | |
Re: [QUOTE=the.future.zone;247938]Thanks very much for that code. Unfortunately, that wasn't what I need. I know how to work with int, but not with char. What I need is an explanationon how to work with char, not the code itself. Thank you for the input. It was worthwhile.[/QUOTE]Working with int is exactly … | |
Re: Although you can change the Display modes at the top of the page, the default is Linear mode, but you can change to Threaded or Hybrid mode where the posts will appear in a different order. | |
Re: How would you do it on paper? Imagine you're back at infants school where they teach you how to add up using columns of hundreds/tens/units with a carrier at the bottom. | |
Re: [QUOTE=Eddy Dean;247322]2nd: You did not include <stdafx.h>[/QUOTE] stdafx.h isn't part of standard C++, it's something which MSVC++ uses for precompiled headers. | |
Re: [QUOTE=brianotieno;247274][B][I][COLOR=Blue]if you run this code in c++ you get the following error at the underlined part is where the problem is : error C2143: syntax error : missing ';' before 'constant' : fatal error C1004: unexpected end of file found Error executing cl.exe.[/COLOR][/I][/B][/QUOTE] What you've got there is barely C++ … | |
Re: [QUOTE=JW1873;246993]could someone please provide me with the answersd to the following c++ problems, they are simple problems which are probably an insult to most of your intelligence but i'm clueless and desperate.[/QUOTE]More the fact that you obviously missed this post here.. [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: That depends exactly what part you don't understand. Essentially, your problem seems to be about looping through arrays, and performing some operation on each element. If you're not comfortable with arrays, then do a google search for array tutorials, or check: [url]http://www.daniweb.com/tutorials/tutorial1732.html[/url] [url]http://www.cprogramming.com/tutorial/lesson8.html[/url] Here's one for 'C' Style strings, which … | |
Re: [QUOTE=saishn;246937]I get a segfault when I run the following. Seems to fail at strcpy. [code] #include <cstring> using std::strcpy; int main() { char * word = "word"; strcpy(word, "what"); } [/code] If I change char * word to char word[], it's fine. I thought that both declarations effectively do the … | |
Re: [QUOTE=grunge man;245768]um WaltP whats haveing your code properly formatted mean?[/QUOTE]Aside from code tags, It also helps using a clear & consistant coding style, and having it properly indented (something which your IDE will probably do for you). Things like that will not only help other people read your code, but … | |
Re: You can't return multiple values from a function, you probably want to pass your variables by reference instead. ie [CODE][COLOR="Blue"]void[/COLOR] ReadInput (int[COLOR="Red"]&[/COLOR] a,int[COLOR="Red"]&[/COLOR] b) { cout<<"Please enter flavour(1=choco,2=caramel,3=mint) : "; cin>>a; cout<<"Please enter number of cartoons(1-20) : "; cin>>b; }[/CODE] Notice the ampersands (highlighted in [COLOR="Red"]red[/COLOR]), to denote 'pass by … | |
Re: I think what you may be looking for is more general computer science theory than anything specific to C++ (especially if you have no interest in learning the language at this time). You should google around for OO design theory, since it applies to many other languages, not just C++ … | |
Re: [De-cloak] :eek: Assuming that your array of random numbers is constant, then your 4 elements are always indexed by the numbers 0,1,2,3 .... that should make life pretty simple :) Start it out as a simple random-number picker for the numbers 0-3 and carry on from there. [/De-cloak] | |
Re: This was my usenet signature for a long time :) "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989 | |
Re: The majority of ads on here are google ads, which are relatively non-intrusive IMHO, compared to some sites which use horrible flash-based ads (I deliberately have a flash blocker for those, since uninstalling flash just meant i was prompted to reinstall flash every 5 minutes :mad: ). If you use … | |
Re: [QUOTE=CStallion]I need to insert a "é" and other such symbols. At first I just tried using é straight out in C++ and it returned Θ. So I looked at my character map and did the unicode version \u00E9 where I wanted the é and it still returned Θ. I guess … | |
Re: You're trying to create objects of type Button, but don't have the constructors to match. Remember that if you provide your own constructor within a class, then you do not get a default constructor. You also seem to have other problems - you can't assign an int to an object … | |
Re: [QUOTE]I know there is a book section, but I'm accually more after personal suggestions/reviews.[/QUOTE] Did you actually read the [I]C++ Books[/I] thread stickied at the top? | |
Re: You have included the C++ string library in your code, so why don't you actually use it? C-Style strings ([COLOR="Blue"]char[/COLOR][] and/or [COLOR="Blue"]char[/COLOR]* ) are considered 'bad' in C++ - They are just making your life harder, and your code less readable. also, this line is bad (even in C, I … | |
Hello, This is mainly a message to Dani (although interested to know whether anyone else has seen this..) The the PM message frame extends too far to the right (at least on my screen @ res 1280x1024). It cuts off the right-hand-side of the PM message window, so long lines … | |
Re: [QUOTE=Ancient Dragon]what's the difference between [b]deep[/b] copy and [b]shallow[/b] copy or [b]not so deep[/b] copy :rolleyes:[/QUOTE]As far as I understand it, when copying an object containing pointers to dynamically allocated memory, a shallow copy (which occurs by default) only copies the bare pointer members, so that the two objects both … | |
Re: This looks just like the last question you asked. what don't you understand about it? | |
Re: Your problem is that you don't have a constructor for the Selectionsort class which accepts the values you're trying to initialise it with. You should try a constructor which accepts a range of values - eg, [INLINECODE]Selectionsort::Selectionsort(int* begin, int* end) [/INLINECODE] or one which accepts an array, eg, [INLINECODE] Selectionsort::Selectionsort(int … | |
Re: You've only just started C++ and you're trying to implement a doubly linked list? You might want to start out with a singly linked list first... Also, it's hard to see exactly what is supposed to be going on in your code without seeing the definition of [I]Name[/I] [QUOTE][CODE]#include <iostream.h> … | |
Re: [QUOTE=ghadahelal]what is the flash input buffer? if u don't mind 2 explain for me[/QUOTE]He said "Flush the input buffer" meaning empty all the data from the input stream. | |
Re: [QUOTE=Ancient Dragon]In main() the program should have a for loop that counts from [COLOR="Red"]0 to 12[/COLOR] (once for each month) and inside the loop ask for the values of rainfall, high_temp and low_temp, then put these values in the array. [/QUOTE]I'm sure it was just a typo, but for 12 … | |
Re: This seems to me an excersize similar to serialisation. A real linked list would use pointers to connect the "nodes" - if you're using an array to simulate addressable memory, then use an int to contain the array indexes, simulating the pointers. The rest of the program should be fairly … | |
Re: [CODE]ch2=pow(2,index + 1);[/CODE]Why did you add 1 to the index? - 32 (2^5) in binary is [INLINECODE]00100000[/INLINECODE] - The code would give your expected result without that. | |
Re: I think my main concern would be the ugly mess that you'd get as a result of mixing the two :) | |
Re: What exactly are you going to do with your deck of cards? I presume you'll have some common routines such as "shuffle", "cut deck", etc. but different card games use different rules. A totally generic deck might not be possible, or even desirable. I suggest you decide first which games … ![]() | |
Re: by "Print function" I guess you mean the method to output to the screen or console window? the typical way to output the contents of a 2D array involve a nested loop, eg, [CODE]for(int x(0); x!=total_rows; ++x) { for(int y(0); x!=total_columns; ++y) std::cout << arrays[x][y]; std::cout << endl; } [/CODE] | |
Re: C++ has features way beyond most other languages (eg multiple paradigm support in OOP and Parameterised programming), a huge community and wealth of high quality books available, and C++ really has no arbitary limitations in terms of what you can do with it. However, there's no such thing as perfect … |
The End.