1,288 Posted Topics

Member Avatar for Oliver_1

Ensure it really is called Motto.cpp Windows has a terrible habit of adding extra bits to the end of file names, and then hiding it from you; if you wrote Motto.cpp with a standard issue text editor, for example, it might be called Motto.cpp.txt

Member Avatar for Ancient Dragon
0
188
Member Avatar for nitish.mohiputlall

Line 19. What is the value of `n`? Also, your function `fun` just plain doesn't work. That loop doesn't loop. The first time you get to line 21, the function finishes.

Member Avatar for Assembly Guy
0
170
Member Avatar for dev90

No. Only free something you allocated using malloc. You don't use malloc, so don't use free. The problems. Firstly, you are returning a pointer from your function `toBin`. What does it point at? A local variable, made inside that function. The local variable shouldn't exist anymore once the function ends. …

Member Avatar for dev90
0
264
Member Avatar for VBOI

I think you might be trying to ask "How can I turn a string into a double?" http://www.parashift.com/c++-faq-lite/convert-string-to-num.html

Member Avatar for Moschops
0
114
Member Avatar for daniel1977

The first one is a warning rather than an error. You've got an object of type time_t and you're using it as an unsigned int. The second one; you are passing a pointer to a pointer (to a bSearchTreeType<elemType>), where it is expected that you pass just a pointer (to …

Member Avatar for UFOOOOOOOOOOO
0
154
Member Avatar for victor_3
Member Avatar for donlxu

`while(term > limit)` At this point, the first time this line of code is reached, what is the value of `term`? Also, look at this section of code: int denominator=1; term=(1/(pow(denominator,number))); What value will `demoninator` have in that calculation, every time?

Member Avatar for donlxu
0
196
Member Avatar for sudesh.yadav.104

What happens if you don't try to use the same pointer (i.e. don't use hwnd twice)?

Member Avatar for sudesh.yadav.104
0
215
Member Avatar for zuki88

Do you know what `strcmp` does? `strcmp` is a function that accepts *char pointers*. You don't have char pointers. You have C++ *strings*. You can compare a C++ string like this: `if (response == "ok") ` echo "word was found in webpage"; This doesn't look like C++ code. *echo* is …

Member Avatar for zuki88
0
133
Member Avatar for supriya badam
Member Avatar for irum.nageen.3
0
2K
Member Avatar for kay19

This: int test = int_ary[rand()% ((0 + 16383)-8191)]; picks one value from your array or maybe from way off the end of your array (which has never been set), and makes the int `test` equal to that value. Why? Anyway, inside your loop, you are doing this, over and over …

Member Avatar for kay19
0
304
Member Avatar for ben25x
Member Avatar for ben25x
0
384
Member Avatar for Jugottabe

Some of your objects don't seem to make a lot of sense. I see you have a `card` class. Let's look at that. Here are some of its internals: char suit[4]; int value[13]; So one card has an array of 4 `char`s, named suit, and also an array of 13 …

Member Avatar for Jugottabe
0
390
Member Avatar for mark5rockzz_1

Impossible is a big word. It would definitely be painfully complicated and would change some very fundamental ideas, though. Here's just one reason why. The compiler works on one translation unit (which you can roughly think of as one cpp file) at a time, and then forgets about it when …

Member Avatar for mark5rockzz_1
0
294
Member Avatar for mdgowhar

`cx[8]=1.0; cy[8]=-1.0;` cx[8] does not exist. It stops at 7. Same for cy[8]. You're doing too many iterations. You need to stop your loop earlier.

Member Avatar for mdgowhar
0
174
Member Avatar for charishma

If you actually have to swap them, there are ways to do it without using any more variables. My favourite is this: i ^= j; j ^= i; i ^= j;

Member Avatar for Ancient Dragon
0
260
Member Avatar for ztdep

C++ and C linkage is different. http://stackoverflow.com/questions/12066279/using-c-libraries-for-c-programs

Member Avatar for rubberman
0
399
Member Avatar for kal_crazy

What ideas do you have already? You must have at least one; tell us that, and we can go from there.

Member Avatar for DawnofanewEra
0
520
Member Avatar for Wireboy

You could have the user enter a string, and if that string is "QUIT" the programme exits, and if that string is a number, convert it into an int and return it, and if the string is something else, reject it and ask the user to enter a new input.

Member Avatar for Moschops
0
212
Member Avatar for phorce

> But, in Parser I can't seem to access the data member? In the constructor `Parser()`, you access the data member of the Parser object (named `f` in your code). You resized the data object of the object named `w`. That's a different object.

Member Avatar for iamthwee
0
153
Member Avatar for thephoenix.21

There are many, many ways. Here's one. Being able to use existing libraries written by other people is a valuable skill; it gives you a lot more capability in your programs, and it exposes you to other people's code and other ways of doing things. It's also very encouraging to …

Member Avatar for Kenney_1
0
201
Member Avatar for kal_crazy

Alternatively, if you just want to show pictures on the screen and you don't need fancy 3D wonder, you can use one of the many existing libraries or widget toolkits that make it much easier.

Member Avatar for Ancient Dragon
0
346
Member Avatar for nitish.mohiputlall

When you enter the number 45, what gets stored in the variable `value`? Which of your switch cases handles that? Where is `case 45:` ?

Member Avatar for Rahul47
0
216
Member Avatar for mum.roy.77

We need a question. What does your code do that you think it shouldn't do, or what do you want it to do that it doesn't do, or does it not compile, or something else?

Member Avatar for nitin1
0
218
Member Avatar for azurekite

Do you know how to actually solve this, and you just don't know how to code it, or do you have no idea how to solve this?

Member Avatar for azurekite
0
135
Member Avatar for Abo0od

`Access violation reading location 0xccccccc0.` The popular compiler from Microsoft uses the value `0xcccccccc` to indicate a value on the stack that you never set to anything (i.e. uninitialised stack memory). The obvious conclusion here is that you are using a pointer that you never set to any value. Let's …

Member Avatar for Moschops
0
266
Member Avatar for phorce

What's the size of each value? Are these simple int or double or the like, or some custom class? If you're generating these values and then operating on them, writing them to a text file and then reading them back in again is massively expensive in time and pretty pointless. …

Member Avatar for Moschops
0
233
Member Avatar for microlifecc

As Pinku says, you need a new type. You have two options. Either you can use one of the existing libraries that handle types this large, or you can handle it yourself. I usually point people towards the GNU Bignum library, but others exist. If you decide to handle it …

Member Avatar for Moschops
0
251
Member Avatar for ProDev7

As Ketsuekiame says, be aware that there is no strict definition of "Debug mode" and "release mode". If your IDE provides these two modes, all it does it turn on or off a number of compiler options depending on which mode you pick; options chosen by someone else with the …

Member Avatar for ProDev7
0
207
Member Avatar for Mantroskylo

I see you're not using the standard C++ vector template objects, but instead some other kind of Vector, presumably defined in `Vector.h` Without knowing what that object is, we can't tell you how to get int values out of it.

Member Avatar for rubberman
0
291
Member Avatar for laavanya

Start with the number zero, and each time an object is created, add one. That's the logic. If you mean something like creating a class, and counting how many times an object of that class is created, put the functionality to do the counting inside the constructor and make the …

Member Avatar for laavanya
0
2K
Member Avatar for abhinav.gokooloopadhya.5
Member Avatar for manel1989

When you say > what I want is to display in the following location C: \ Users \ abdelhalim \ Documents. do you mean you want to write it to a file in that location?

Member Avatar for manel1989
0
288
Member Avatar for nmakes

What size is the array you make like this? `char NAME[];` So how much data can you write into it?

Member Avatar for nmakes
0
249
Member Avatar for devourer17

We're not really into giving people complete answers here; we tend to help you fix it yourself. You say that your code is giving errors. Let's see the code! I would expect that your file reading code in its simplest possible form would look something like this: ifstream fileToRead("someFileName"); fileToRead …

Member Avatar for Moschops
0
463
Member Avatar for glenwill101

You're trying to make an iterator that deals with maps like this: `std::map<string, Object>` but your actual map looks like this:`std::map<string, Object*>` As an aside, one of the very useful things brought to us by C++11 is the auto keyword allowing you to make iterators something like this: `auto itr=_c.begin();`

Member Avatar for glenwill101
0
418
Member Avatar for pars99

This is hardware dependent. Look at your PC. There are connectors on it. USB ports, maybe a parallel port and a serial port. Using C++, you can ask the operating system to set voltage values on those connectors. Some operating systems will only allow you to set it to low …

Member Avatar for mike_2000_17
0
2K
Member Avatar for MasterHacker110

The second constructor there is using an *initialisation list*. There's no difference in the final state of the object when it's finished. If any of your member variables were const, or references, the initialisation list would be the only way to set the values. It's also usually faster to use …

Member Avatar for rubberman
0
115
Member Avatar for nitin1

You know there's only one way to know for sure which, on a given system, will run faster. Build them, time them.

Member Avatar for rubberman
-1
156
Member Avatar for ram619
Member Avatar for ram619
0
195
Member Avatar for jony_munsi

#include <stdio.h> int main() { printf("Fill the three up, and pour it into the five. Fill the three up aain, and pour it into the five until the five is full. You now have one unit of liquid in the three container. Empty out the five, put the one unit …

Member Avatar for Gonbe
-4
122
Member Avatar for Assembly Guy

CImg springs to mind. Here is a complete working program to draw a 500x400 image on screen, with one pixel set to green. It is C++, though; have you got your heart set on doing it completely in C? #include "CImg.h" #include <iostream> using namespace cimg_library; int main() { // …

Member Avatar for Assembly Guy
0
394
Member Avatar for alex9620

The compiler begins reading the code at the top, and goes downwards through it, once. When it gets to a function call, like this: `print(marks);` it has to *already know* what parameters that function takes, and what it returns. There are two ways it can already know this. Either you …

Member Avatar for MandrewP
1
395
Member Avatar for nchy13

As a rule of thumb, a temporary object has no name and you can't get its address. So the string named `str` is not temporary; it has a name. In your second code, it looks like you've got an `int` object and you're trying to pass it to a function …

Member Avatar for nchy13
0
840
Member Avatar for Fjdd

Does mmcdonald's code above not work for you? Here's a minimal, complete messagebox example that works on Win32. Does it work for you? #include <windows.h> INT WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR lpCmdLine, INT nShowCmd) { int nResult=MessageBox(NULL, "An example of Cancel,Retry,Continue", "Hello Message Box!", MB_ICONERROR|MB_ABORTRETRYIGNORE); return 0; }

Member Avatar for Fjdd
0
4K
Member Avatar for Lp_baez

That code compiles without any problems. This suggests that the code you showed us is not the code you're trying to compile.

Member Avatar for Unimportant
0
298
Member Avatar for christinetom

What operating system are you working with? I'm guessing windows, but I should check. If so, this might be what you're looking for: http://dslweb.nwnexus.com/~ast/dload/guicon.htm

Member Avatar for christinetom
0
149
Member Avatar for nchy13

Why not pass by reference? The std::string class comes with a number of class functions for modifying the string. Using those is the standard way to modify the string.

Member Avatar for NathanOliver
0
960
Member Avatar for Yashaswi_1

This is a problem with you using your text editor. Try pressing the "insert" key on the keyboard.

Member Avatar for Moschops
0
238
Member Avatar for Tony.Z

There are many opportunities in your code to enter the value 'y'; please tell us the complete input you typed in, what the output was, and what you expected the output to be.

Member Avatar for RonalBertogi
0
409

The End.