1,288 Posted Topics

Member Avatar for sergent
Member Avatar for Kanoisa

You can trash your stack to the point that the bt information is lost. If you can build your programme to run on your Linux machine, run your programme under valgrind (be sure to have built a version with debug symbols) and if you're stomping all over your own memory, …

Member Avatar for Kanoisa
0
386
Member Avatar for pcgamer2008
Member Avatar for yobbko

Yes. C++ can make your processor do anything and everything it is capable of doing.

Member Avatar for raptr_dflo
0
947
Member Avatar for gregarion

[QUOTE]but if you use a normal calculator , the answer should be 30.[/QUOTE] Does "normal" mean "broken" in this case? If that's what your calculator says, either it's broken, or you're not using it correctly.

Member Avatar for tkud
0
121
Member Avatar for programing

I really, really do not think you want to write your own compiler.

Member Avatar for template<>
0
124
Member Avatar for visom

Let's take a look at the function setadd. [B]void fraction::setadd(int num1, int den1, int num2, int den2)[/B] There it is. It takes one, two, three, four integer parameters. That means that when we call this function, we must give it four arguments, which must all be of type int. Something …

Member Avatar for visom
0
294
Member Avatar for eman 22

A string* is a pointer to an object of type string. A pointer is typically the size of an int or two, but it's dependent on your system. You can find the size of any object with sizeof. For example, [CODE]string* someStringPointer; int size = sizeof(someStringPointer);[/CODE] I suspect you actually …

Member Avatar for mrnutty
0
103
Member Avatar for lexusdominus

This is a big OR statement. It says... If any of the following four things are true, execute the statement: 1) initialize == "off" && Iminor > 20 2) Imedium > 10 3) Isevere > 5 4) Ifatal > 0 You say that 2, 3 and 4 all come out …

Member Avatar for lexusdominus
0
130
Member Avatar for Jimmyteoh
Member Avatar for FujiFilm

If you mean those underlined variables to be strings, you have to put [B]"[/B] around them. [B]CBus::CBus(int a = 1995, char *b = "Sedan", char *c = "Mazda")[/B]

Member Avatar for rubberman
0
142
Member Avatar for Saddi
Member Avatar for jonsca
0
119
Member Avatar for Amr ElGohary
Member Avatar for WaltP
0
149
Member Avatar for montjoile

What happened to all the semi-colons? Have the brackets from your [B]if[/B] and [B]else[/B] vanished as well, or is the code above your actual code?

Member Avatar for abhimanipal
0
133
Member Avatar for Euphan
Member Avatar for munitjsr2

If I have an object that carries out some clever mathematical calculations, and needs to maintain some internal variables to do so, it would be foolish of me to do anything with those variables other than hide them. If they can be changed directly by a user/coder, then the next …

Member Avatar for Clinton Portis
0
162
Member Avatar for Olifant

[QUOTE]how do you come up with it [/QUOTE] You come up with it by thinking about the problem and developing an algorithm to solve it in a methodical way that is appropriate to being turned into code. For example, I might look at this and think that the steps will …

Member Avatar for Moschops
0
102
Member Avatar for pravej

[B]"this is a string of base"[/B] is a string literal. A string literal is a constant. Your code is trying to directly change a string literal; do not try to change things that are constants. The C++ standard says [I]The effect of attempting to modify a string literal is undefined.[/I] …

Member Avatar for pravej
0
146
Member Avatar for Derek Elensar

Aside from the issue of reading data from file, on line 24 you appear to be using the array of char called [B]marker[/B], but you've never put any values into that array.

Member Avatar for Derek Elensar
0
177
Member Avatar for Admiral Pimms

bullets is an array of pointers to Bullet objects. When you delete a bullet object, you are essentially marking the memory of that bullet object as available for something else - there is no guarantee that the memory is changed and it may well remain exactly as it was. The …

Member Avatar for Admiral Pimms
0
430
Member Avatar for cppjosh
Member Avatar for vikrantk
Member Avatar for Derek Elensar
-2
288
Member Avatar for bkoper16

You have not provided the default constructor [B]Account::Account()[/B], and it seems something wants it.

Member Avatar for griswolf
0
10K
Member Avatar for dodgers

How about something like this? [CODE]cout << "userId is " << userID << endl;[/CODE]

Member Avatar for Moschops
0
168
Member Avatar for andimiami

[CODE]string parseInputString (string) { string oneline; string last, first, result; oneline = last + ", " + first + "."; return oneline; }[/CODE] This function will always return ", ." because you never put anything in [B]oneline[/B], [B]last[/B], [B]first[/B] or [B]result[/B]. Also, whatever variable you're feeding to this function has …

Member Avatar for Moschops
0
133
Member Avatar for SillySpAz

Because you never actually do anything to put numbers in totalCommission or basePay. It's just chance that they're set to zero. You're doing nothing with them. You made some functions to calculate these values, but you never call the functions.

Member Avatar for SillySpAz
0
129
Member Avatar for JohnBoyMan

x->someMemberVariable is for accessing a member variable/function when x is a pointer to an object. x.someMemberVariable is for accessing a member variable/function when x is the object, not a pointer to the object. x->someMemberVariable is shorthand for (*x).someMemberVariable Use x->someMemberVariable when your x is a pointer to an object, use …

Member Avatar for WaltP
0
86
Member Avatar for dizzymrswagg

We tend not to just give you working code. Is it that you don't understand the equation, or that you struggle with the C++ code? Note that C++ has a standard math library, but no math class. Do you have some kind of math class that you are to use, …

Member Avatar for Moschops
-1
114
Member Avatar for Labdabeta

Do you mean the output has to be a string, or do you mean that you're forbidden from using anything but a string in your code?

Member Avatar for nezachem
0
154
Member Avatar for jmcginny5

There's really no trick to it. Take each function in turn and implement it. For example, the function [B]int Complex::getReal()[/B] returns the real part of the complex number. So, you need to write some code that [B]return[/B]s the [B]real[/B] of the object.

Member Avatar for jmcginny5
0
2K
Member Avatar for jimmymack

This again. You're asking the wrong question. It isn't why does it close; it's why haven't you done anything to keep it open? [url]http://www.cplusplus.com/forum/beginner/1988/[/url] [url]http://www.daniweb.com/software-development/cpp/threads/12177[/url]

Member Avatar for jimmymack
0
168
Member Avatar for choboja621

Remove the .h from iostream.h - it it just #include <iostream> You have not specified a namespace, so cout and cin should not work - they should be std::cout and std::cin. If your compiler lets you get away with this, it really shouldn't. [B]main()[/B] is illegal - your compile should …

Member Avatar for Moschops
0
99
Member Avatar for shyla

[CODE]linkedlist::isMumber(double x)[/CODE] You need the return type on the front of that.

Member Avatar for Moschops
0
555
Member Avatar for sinatra87

You do not have anything set wrong on your PC. This is how Visual Studio works. Your programme gets made an an executable file. The executable file is run from the command line. If you open a console window and run it yourself manually by typing the name of the …

Member Avatar for sinatra87
0
2K
Member Avatar for alice_k

As an aside, this is C++; you don't need to keep repeating "struct" every time you create a new instance of one.

Member Avatar for Moschops
0
723
Member Avatar for Khoanyneosr

[CODE]bool done = true; while (!done)[/CODE] [B]done[/B] is true, therefore [B]!done[/B] is false, therefore the while loop will not execute.

Member Avatar for Fbody
0
104
Member Avatar for predator78

[QUOTE]1. Are data structures essentially classes minus methods which can preform actions on the memebers that are held inside?[/QUOTE] [QUOTE=007]A struct can't hide which variables are private or public but a class can. I think that is the biggest distinction.[/QUOTE] [B]That's completely untrue.[/B] Do not read the post above. In …

Member Avatar for NicAx64
0
379
Member Avatar for sha11e

[QUOTE]No, C is not used anymore much expect in OS development.[/QUOTE] There is more embedded hardware running C code than there are PCs running operating systems. Just because [I]you [/I]don't code in a language doesn't mean nobody does.

Member Avatar for sergent
0
213
Member Avatar for mistereff

How about simplifying your code a little? On the assumption that there are 49 elements in the array (i.e. it is a 7 x 7 array) [CODE]int numberOfSheep = 0; for (int i=0;i<49;i++) { if (*board[i] == 'S') numberOfSheep++; }[/CODE] Edit: This is not a complete programme. It needs a …

Member Avatar for sfuo
0
157
Member Avatar for Eng_suha

You see this opening brace, "{", in your code? class Shop[B]{[/B] Where is the closing brace that goes with it?

Member Avatar for Eng_suha
0
141
Member Avatar for sing1006

In your code, you are returning something called new_value. What is that? It does not exist. Return the value you want to return, not some made up value that does not exist.

Member Avatar for sing1006
-1
112
Member Avatar for toferdagofer

You can just use the forward slash key instead; it will work on all the common desktop operating systems. [url]http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.16[/url]

Member Avatar for Moschops
0
161
Member Avatar for hawita

How would [I]you[/I] guess the number? Write out those steps, and that's your algorithm. It might be something along the lines of: Pick a number halfway between the minimum and maximum possible numbers. If correct, stop. If too high, change possible maximum to this guess minus 1 and start again. …

Member Avatar for Moschops
0
152
Member Avatar for IndianaRonaldo

This is dependent on your operating system. [url]http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.17[/url] If you're using some kind of *nix and have termios.h available, [url]http://www.doctort.org/adam/nerd-notes/reading-single-keystroke-on-linux.html[/url] Otherwise, tell us your operating system and we'll point you the right way.

Member Avatar for IndianaRonaldo
0
181
Member Avatar for harinath_2007

[QUOTE]What libraries i should use to use the OS functions ????[/QUOTE] It depends on your OS.

Member Avatar for Moschops
0
105
Member Avatar for eman 22

This function creates a [B]list[/B], named [B]q[/B], on the stack. That object [B]q[/B] is destroyed when you return from this function. If you want to return a pointer to an object, you will have to do something to ensure that the object exists after the function returns. This is commonly …

Member Avatar for Moschops
0
128
Member Avatar for hawita

[CODE]class vector { manipulateInCartesian (&vectorType); manipulateInSpherical (&vectorType); manipulateInCylindrical (&vectorType); vectorType add (vectorType, vectorType); vectorType multiplyByScalar (scalarVal, vectorType); vectorType dotProduct (vectorType, vectorType); vectorType crossProduct (vectorType, vectorType); }; [/CODE] Don't forget to implement the functions and define a vectorType.

Member Avatar for jonsca
-1
121
Member Avatar for a.muqeet khan

You see where you put [B]using namespace std;[/B] ? By doing that, you included a whole lot of already defined functions and classes. One of those is called [B]distance[/B], so you have defined [B]distance[/B] twice. This is exactly why slapping [B]using namespace std;[/B] on the top of everything without understanding …

Member Avatar for a.muqeet khan
0
169
Member Avatar for TailsTheFox

Just the header file will be useless to you without the all the other header files, source code and compiled libraries it uses. The complete set of all that, for Windows 7, is about a gig and a half's worth of download.

Member Avatar for Ancient Dragon
0
1K
Member Avatar for harinath_2007

The End.