466 Posted Topics

Member Avatar for chound

Dude! This is an EIGHT-YEAR-OLD thread! You should probably start a new thread for your question :0)

Member Avatar for ravenous
1
272
Member Avatar for buckeyemike

You almost certainly don't need to make anything a friend of anything else to do whatever it is that you're trying to do. Post the code that you have so far and we can have a better look at it...

Member Avatar for mike_2000_17
0
217
Member Avatar for TheTimeCat
Member Avatar for TheTimeCat

Your algorithm will recurse on line 34, adding a new element to `combination` until it contains {0, 1, 2, 3}, since that's the size of `S`. On the recursion after the 3 is added, `last`, on line 29, will contain the final element of `combination` (3). On line 30 you …

Member Avatar for ravenous
0
950
Member Avatar for TheComputerGuy

Is this a question? The code that you have will indeed check if the file exists or not. To write to a file, you'd need a `std::ofstream`, but that's the only difference.

Member Avatar for tinstaafl
0
331
Member Avatar for dokukani

You have the indices swapped when accessing the elements of `temp` in the functions `hitemp` and `lowtemp`. You have: temp[ HIGH ][ i ]; you should have: temp[ i ][ HIGH ]; You could try making a `Range` structure and keep an array of those instead: struct Range { double …

Member Avatar for remunance
0
361
Member Avatar for Feal456

> Also try using at the top: > #define Socks 15 #define Underwear 10 #define Glasses 5 ...instead for all your items. Then you can perform mathmatical functions on them Don't do this. It's fine to do maths on `char` values (as long as you don't assign a value that …

Member Avatar for CGSMCMLXXV
0
3K
Member Avatar for nitin1

From [cplusplus.com:](http://www.cplusplus.com/reference/utility/pair/) > The header <utility> also overloads the relational operators ==, <, !=, >, >= and <= , so as to be able to compare pair objects of the same type directly: > Two pair objects are compared equal if the first elements in both objects compare equal to …

Member Avatar for vijayan121
0
125
Member Avatar for memo0o

I don't think that you use any of the functions from `conio` in this code, you should be able to just delete the line that includes it. Also, you have an issue with the curly braces in your code. All your functions are effectively defined *inside* `main`, which is not …

Member Avatar for ravenous
0
205
Member Avatar for asteriskLMNOP

The point of inheritance is that you *don't* need to do this. The question of which version of `toString` to call is decided at run-time. That's the point of `virtual` functions. So, consider this example: #include <iostream> #include <vector> class A { public : virtual void Print() const { std::cout …

Member Avatar for ravenous
0
1K
Member Avatar for tensity

You just have a misplaced bracket. You have this: list.erase(std::unique(list.begin(), list.end(), list.end())); It should be this list.erase(std::unique(list.begin(), list.end()), list.end()); Did you spot the difference :) I think you get this compilation error because, in your version, the compiler is trying to use `list.end()` as a comparator (and it expects the …

Member Avatar for vijayan121
0
322
Member Avatar for john.halbert.37

`execl` is designed to exit your process and start a new one. I've never used it though. Try reading [this](http://geoffgarside.co.uk/2009/08/28/using-execve-for-the-first-time/), it looks like it has some useful information in it.

Member Avatar for john.halbert.37
0
217
Member Avatar for new_developer

There's a sticky post at the top of the C++ forum on "flushing the input stream", it should help you understand what's going on here. On another note, I don't understand how you don't just see the "No such type of account" message every time you run the program. You …

Member Avatar for deceptikon
0
1K
Member Avatar for 浩霖

You might have to give a little more detail here. For example, what is a "ttf word form"?

Member Avatar for ravenous
0
172
Member Avatar for amt_muk

I think that boost will do all of these, except the database handling. For that you could use a specific library (although I don't have any suggestions). You could also think about using Qt, it has cross-platfom support for all the things you mentioned.

Member Avatar for mike_2000_17
0
266
Member Avatar for tapananand

As Ancient Dragon says, you should just try it an see. On a related note, you can concatenate multiple C-strings like this: #include <iostream> int main() { char s[] = "Hello" ", " "World!"; std::cout << s << std::endl; return 0; } I don't know when it's useful, but you …

Member Avatar for deceptikon
0
777
Member Avatar for putri MSR

*How* is it not working? Does it compile? Does it crash? Does it produce the wrong result? What errors are produced?

Member Avatar for vmanes
0
504
Member Avatar for fize.tesfay
Re: c++

Yeah... this site doesn't really work like that. Did you read [the notes](http://www.daniweb.com/software-development/cpp/threads/78223/read-this-before-posting-a-question) before posting? Write some code and someone will help you fix/understand the errors. Generally, no-one's going to just striaght-up do your homework for you. You have to show some effort first.

Member Avatar for fize.tesfay
0
339
Member Avatar for new_developer

In this case the asterisk indicates that the variable returned by the function is a *pointer*. Google "C++ pointer" for more informaiton. Basically, it indicates a memory address where information of some sort can be found. A `static` member function is one that can be called without needing an instance …

Member Avatar for ravenous
0
254
Member Avatar for tomz6

The asterisk in this context always means a pointer to something. It turns out that the "something" can also be a pointer. So, `char **argv` means that `argv` is a pointer to a pointer to a `char`. The reason for this is that each command-line argument is read in as …

Member Avatar for ahmedhamdy
0
587
Member Avatar for peymankop

You will have an infinite loop in this program if you ask for any line that isn't "javad" and that line is found in the file. You should have another call to `getline` inside the inner `do{ ... }while` loop. Somewhere between line 21 and line 25. If you want …

Member Avatar for Lucaci Andrew
0
129
Member Avatar for tomz6

>But why does the video tutorial use iostream and works for him? You need to use both `<iostream>` and `<string>` to get this to work. The way C++ works, if one of the headers that you include also includes another header, then that header will also be included. It's almost …

Member Avatar for mike_2000_17
0
3K
Member Avatar for panatda.tokhume
Member Avatar for arnabjonty

Are you using a `std::string`? If so, you can use a combination of the `find` and `erase` methods: std::string s( "The quick brown fox jumps over the lazy dog" ); std::cout << s << std::endl; std::string::size_type position = s.find( "jumps" ); s.erase( position, 6 ); // Use a size of …

Member Avatar for Lucaci Andrew
0
156
Member Avatar for tomz6

If you don't want to use `std::string` for some reason, then you could use a `std::vector< char >`, or something like that. Or, you could make your own, simple `struct` for keeping a pointer to an array of `char` and a size: struct StringWithNulls { char* chars; unsigned size; }; …

Member Avatar for deceptikon
0
168
Member Avatar for firewall321

I don't think that you're going to find someone on here that is going to post you a complete set of solutions. Maybe you could post what you have of the third solution (which you implied you have started, but got stuck) and we could help you with that one?

Member Avatar for T-Dogg3030
0
125
Member Avatar for nitin1

If the time taken to allocate a your vector/array is the main time cost in your program, then you're doing well! In reality, I would almost *always* use `std::vector` You could end up saving space. For example, if you make an array of 10000 `int`s then as soon as the …

Member Avatar for ravenous
0
144
Member Avatar for danielkull

The of syntax `temp_m.EZ_MATH::EZ_GE_BY_ME();` looks very strange, maybe you could post more of the program for context? For example: * what type is `temp_m`? * What is the code in the function `EZ_MATH::EZ_GE_BY_ME`?

Member Avatar for ravenous
0
288
Member Avatar for andrew mendonca

> I'm not sure if I am doing the functions correctly. Is there anything I need to change? You're not and there is. Consider the `GetPlayer` function: int GetPlayer(PlayerInfo[]) { PlayerInfo playerid = {20}; PlayerInfo firstname = {20}; PlayerInfo lastname = {20}; cin >> playerid >> firstname >> lastname; return …

Member Avatar for andrew mendonca
0
480
Member Avatar for marnun

Your function `return`s on line 7. However, `n` isn't incremented until line 9, which will never be exectued (since the function will have returned by this point). Move the `n++;` line before the `return word;` line.

Member Avatar for marnun
0
265
Member Avatar for rocksoad23

> Is there any problem to not define a constructor, but using an object to just access to those methods? No, if you don't provide a constructor the compiler will provide some basic ones for you. If you're only going to declare a class so you can use methods in …

Member Avatar for ravenous
0
152
Member Avatar for MOjo72

Your `Square` class inherits from `Rectangle` and sets the values for the side lengths of the rectagle class in it's constructor, but not its own `lSide` variable. You have also re-implemented the functions for the `Shape` interface in the `Square` class, which you don't need to, since their implementation is …

Member Avatar for ravenous
0
476
Member Avatar for ravenous

OK, so I'm mainly a C++ developer but I've been looking into making apps for Android. I haven't used Java before, or done much UI development, so it's a lot to take in at the moment. **There is a question at the end of this, skip to it if you …

Member Avatar for ravenous
0
153
Member Avatar for rahim_fayaz

Er, you seem to have posted this four times?? There's no "built-in" way to do this in C++, you will have to write a program to do it. Start by looking up "numerical integration" on the internet and trying to make a program to do the things that you find …

Member Avatar for ravenous
0
173
Member Avatar for CHOCHOCHO

> Shouldn't you write line 2 with the length and currentPos variables inside it? No, it's fine the way it is. The variables `length` and `currentPos` are member variables of the `List` class so they are available for use inside all non-static member functions of the `List` class. In this …

Member Avatar for ravenous
0
158
Member Avatar for Magda6347

Your problem is line 9 (in your snippet). The expression FindDepBal(BalDep); doesn't make sense. You can only use this notation when *constructing* a `double`. So, for example, you could do double FindDepBal( BalDep ); // Construct with value or FindDepBal = BalDep; // Assign new value The way you currently …

Member Avatar for ravenous
0
124
Member Avatar for harris24

The first message tells you what the problem is. Look at line 214. It says it's expecting a ';' before the ')'. Is there a ';' everywhere you'd expect a ';'?

Member Avatar for harris24
0
350
Member Avatar for marnun
Member Avatar for marnun
0
1K
Member Avatar for AznWun

If you're *absolutely required* to use a `reverse_iterator`, it's possible to construct a `reverse_iterator` to an array pointer and use that as you would any other `reverse_iterator`: const char s[] = "Hello, World!"; size_t n = strlen( s ); std::reverse_iterator< const char* > rev_it(s + n);

Member Avatar for ravenous
0
323
Member Avatar for jorge.carmonajr

What are the "crazy errors"? I suspect that it's an error in a templated function (they tend to give very verbose error messages). It's probably to do with this function: istream &operator>>(istream &input, Coordinate&) { input << endl; return input; } This will also give you an error: Coordinate Coordinate::operator!=const …

Member Avatar for jorge.carmonajr
0
204
Member Avatar for singlin

You need to initialise all the values of the arrays `sum_darab` and `sum_hr`, not just the first element of each. I would do the initialisation inside the `for (j=0; j<sem; j++)` loop, not before as you have it currently. You will also have a divide-by-zero problem if you have a …

Member Avatar for ravenous
0
7K
Member Avatar for shark101
Member Avatar for James19142

I think that you need to use `memcpy` like this: memcpy( &DefaultComponentHolder, &tmp, DefaultComponents_Arraysize*sizeof( tmp ) ); `memcpy` needs to know the *total* amount of memory that it is going to copy. That is, the number of things multiplied by the size of each thing. The mysterious behaviour that you …

Member Avatar for James19142
0
908
Member Avatar for SeePlusPlus2

> Why/how does 1011 represent the 5 1's at the start of the 32bit number? I'm trying to understand the concept and was trying to figure out how to do it by hand before attempting to write a text compression program. I've never heard of run-length encoding, but 101 is …

Member Avatar for SeePlusPlus2
0
183
Member Avatar for Hopp3r

I think (from your description) that you would just have to declare the `enemyMissileArray` variable in header for Cannon.cpp. However... (This next bit may or may not make sense to you, but it's the way I would do it. Ask if you don't understand) I would probably go for making …

Member Avatar for ravenous
0
199
Member Avatar for <M/>

I hate it when you're waiting at a road crossing or an elevator and someone else arrives and pushes the button. What do they think you were doing? Just standing there trying to work it out? I always want to say "thank god you turned up! I could have been …

Member Avatar for <M/>
0
164
Member Avatar for softwaretime

Yeah, I'm not sure how many takers your going to get on this. In general, downloading and running random executables files from the internet isn't something people like to do.

Member Avatar for softwaretime
0
216
Member Avatar for jlillie

You can't really *remove* an element from an array, all you can do is over-write it. The trick is keeping track of which elements can be over-written and which you want to keep! The best way to do this would be to make a second structure, which "wraps" the array …

Member Avatar for jlillie
0
180
Member Avatar for ravenous

I was making an answer to a post and it ended up being much bigger in scope than the actual answer required. I thought it might make a good tutorial, but I don't see how I can post something in a "Tutorial" section directly? The only option is to "Post …

Member Avatar for mike_2000_17
0
193
Member Avatar for ogrishmania

You can think of two main kinds of relationships between classes in C++ * A class *is a kind of another class* * A class *has other classes inside it* The classic "*is a*" example uses animals. A dog *is* an animal. A cat also *is* an animal. So, for …

Member Avatar for mrnutty
0
286

The End.