1,358 Posted Topics

Member Avatar for CppBuilder2006

I use VC++ 2008 Pro. It compiled, but it threw a warning about the use of wcscpy(). The error recommended the use of wcscpy_s() for security reasons. [QUOTE=VC++ 2008 Compiler]cpp22210.cpp(14) : warning C4996: 'wcscpy': This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. …

Member Avatar for CppBuilder2006
0
209
Member Avatar for sgw

They are roughly equivalent statements. You can do it with the standard data types too. [code] //both these statements are valid: int myInt(15); //constructor version int myInt = 15; //assignment version [/code] For the standard datatypes, there really isn't any performance penalty for doing it via the assignment version. When …

Member Avatar for Fbody
0
186
Member Avatar for JHus00

Your prototype/declaration on line 6 does not match the definition. They must match exactly in order for the compiler to understand what you are doing. The & and * are pointer operators. If you are just learning about functions, you probably haven't learned about them yet. I'm not too sure …

Member Avatar for Fbody
0
188
Member Avatar for Frederick2

I'm not familiar with the Windows API, but this should say it all: [QUOTE] a BSTR is just a typedef of a wchar_t* [/QUOTE] It is a pointer. Pointers can be NULL. NULL is equivalent to 0, which is interpreted as false by a conditional statement.

Member Avatar for Fbody
0
148
Member Avatar for nats01282

Apparently not. The function main() must always be specified "[B]int[/B] main()". If your tutorial doesn't show you that, [URL="http://www.cplusplus.com/doc/tutorial/"]get a new tutorial[/URL] because you're in for a long tedious ride. [edit=someone beat me to it] [QUOTE=photoyid;1142132]Try typing in: [CODE]int main() [/CODE] instead of main(). Also most people write that code …

Member Avatar for nats01282
0
148
Member Avatar for mushroozard

Good luck with that one. This is not a library archive, it's a discussion board. I'm sure you can find a library somewhere out there.

Member Avatar for Fbody
-3
252
Member Avatar for photoyid

Line 47, you are attempting to pass " [B]'[/B]red[B]'[/B] " to polygon::setc(). The single quotes cause literals to be interpreted as characters. To make the compiler interpret it as a string, you need to use double quotes. i.e. " [B]"[/B]red[B]"[/B] "

Member Avatar for photoyid
0
171
Member Avatar for lismoker

It's not looping because you haven't written any loops. [URL="http://www.cplusplus.com/doc/tutorial/control/"]Read this.[/URL]

Member Avatar for Fbody
0
138
Member Avatar for TheWolverine

The second version is better. You've reduced the ambiguity and you haven't hidden any variables. In addition, the functions are using the member variables to produce results. However..., your function2 is specified to return a double and you have no return statement. This would be a better implementation: [CODE]double function2( …

Member Avatar for Fbody
0
293
Member Avatar for FatimaRizwan

Read your compiler's error message, it should tell you the line (within a line or 2) and what you did. You're not going to get much help here unless you share the error message.

Member Avatar for Fbody
-1
122
Member Avatar for anthony5557

He's not upset, believe me. He's a mod, he's enforcing the forum rules. We can't help if you just say "I'm getting lots of errors", it's simply not possible without a starting point. You need to tell us what the errors are. Have you done a Site Search? Have you …

Member Avatar for Fbody
0
208
Member Avatar for Robert1995

[QUOTE=Robert1995;1141710]1) An overview of what your program does. My program works only for strictly pair k.[/quote] Um... This doesn't answer the question. It's asking what your program does, not when it works. [QUOTE=Robert1995;1141710]2) The result of your current code. My current code works for like 1/3 tests that i found …

Member Avatar for Fbody
-1
85
Member Avatar for bobbuilder67

[URL="http://www.cplusplus.com/reference/string/string/c_str/"]Check out the function std::string::c_str().[/URL] Then add some commands to your while loop.

Member Avatar for Fbody
0
119
Member Avatar for sidra 100
Member Avatar for Chichiro

[QUOTE=Chichiro;1140507]And now i have figured out something : there are many types of programming languages and we need them in order to create different types of software , am I right?? ( I hope I din't misunderstand it :D ) And i'm quite interested in gaming , can i do …

Member Avatar for Chichiro
0
387
Member Avatar for thedoodler

You're attempting to re-declare the parameters that you have already sent to the function. The line is completely redundant and not necessary.

Member Avatar for NathanOliver
-2
140
Member Avatar for mikabark

Hmmm.... [URL="http://www.daniweb.com/forums/announcement8-3.html"]Read this[/URL] then try again.

Member Avatar for Fbody
-1
201
Member Avatar for tokomonster

Arrays are already passed by reference by default. There is nothing you need to do to accomplish this. An array is nothing more than a pointer to the address of the first element in the array. When you access an element, you offset from the address of the first element …

Member Avatar for tokomonster
0
195
Member Avatar for programer411

[QUOTE=programer411;1135766]Oh sorry about that I guess that I didn't think about it. About the getshape function prototype I was not told of any requirements.[/QUOTE] What exactly is your intent for getShape()? I'm guessing it is intended to select a fill character. But the net result of the function currently seems …

Member Avatar for tetron
0
473
Member Avatar for jnpnzn

[URL="http://www.sorting-algorithms.com/bubble-sort"]Bubble Sort is a very simple algorithm.[/URL] What seems to be the issue? [URL="http://www.lmgtfy.com/?q=Bubble+Sort"]What kind of research have you done?[/URL] [URL="http://www.daniweb.com/forums/announcement8-2.html"]What have you done so far?[/URL]

Member Avatar for Fbody
0
31
Member Avatar for Akirasan

[CODE]GameTable.h vector <Client*> clientInTable; Chess.cpp //Add client to table void addClient(Client *client) { clientInList.push_back(client); } //remove client from table void removeClient(Client *client) { //search client on list, when found get position pos clientList[pos] = NULL; }[/CODE] Based on what I see, you have created 2 huge memory leaks. There are …

Member Avatar for Fbody
1
192
Member Avatar for igodspeed

Is all of your code contained in one file or spread out over multiple files? Based on you mentioning "modules" in your code, and the includes you've listed. I suspect that it is spread out. Assuming that's correct, it's likely that you're not including <iostream> in one of your implementation …

Member Avatar for igodspeed
0
243
Member Avatar for blakenbama

To answer your primary question, you'll need 3 files: 1.) The provided header file (a *.h file) 2.) The class implementation file (a *.cpp) file. 3.) The main application file (another *.cpp) file. The structure of the program will be the same as any other you should have done to …

Member Avatar for WaltP
0
1K
Member Avatar for sexyzebra19

[QUOTE=mitrmkar;1138777]As per the above class declaration ... [code] // Add Matrix b to this matrix void Matrix::Add(Matrix b) { data_[ <index here> ] += [COLOR="Red"]b.[/COLOR]data_[ <same index here> ]; } [/code] [COLOR="Red"]That's [/COLOR]how you access the other object's (b) [ICODE]data_[/ICODE] member. So the next step would be to put that …

Member Avatar for Fbody
0
125
Member Avatar for moods125

What's the error? No one can help if they don't know what the error is or where to start...

Member Avatar for Fbody
0
143
Member Avatar for tintin.iitk

You might consider making your derived class completely independent of the base class. If you have sufficient control of the source, you could then redesign your derived class to add a pointer to a pre-existing instance of the base object. This would imply a private pointer variable with some sort …

Member Avatar for tintin.iitk
0
2K
Member Avatar for Nicris

This is the way I understand it: A reference variable such as "p" becomes equivalent to, or a synonym for, "a" and you can use the variable names interchangeably without any special operations (although it's not really recommended for maintainability reasons). If you change "p" you change "a" and vice …

Member Avatar for NathanOliver
0
138
Member Avatar for mmgoicochea

When defining functions, you need to be sure that the prototype's and definition's arguments match exactly. By not making sure they match, you unintentionally overloaded num() and results() to num(long) and results(int, float, double) ... sort of..... Which confuses the compiler.

Member Avatar for mmgoicochea
0
113
Member Avatar for caribedude
Member Avatar for caribedude
0
252
Member Avatar for wwsoft

Yes, but you'll have to overload the relational operators first. This is necessary so that they know how to compare elements of your class. Otherwise you will probably not get desirable results. [URL="http://www.cplusplus.com/doc/tutorial/classes2/"]http://www.cplusplus.com/doc/tutorial/classes2/[/URL] [URL="http://www.cplusplus.com/reference/algorithm/sort/"]http://www.cplusplus.com/reference/algorithm/sort/[/URL]

Member Avatar for mitrmkar
0
104
Member Avatar for suncica2222

You could test your program on a Virtual Machine. If it messes something, you should be able to just start up a new machine image. My IT consultant does it all the time. Don't ask me how.

Member Avatar for suncica2222
0
127
Member Avatar for angel6969

You should figure out how to use [B][noparse][code=syntax]...code tags...[/code][/noparse][/B] so that people can read your code. It's hard to tell, but it appears that your constructors are definitely not right. Also, how do you plan to get Celsius from Kelvin if you only [icode]return CelsiusTemperature;[/icode]? From what I can tell …

Member Avatar for Fbody
0
2K
Member Avatar for Aliun

[QUOTE=Aliun;1135655] Well (rand()%8)-1; is simply because [B]I was too lazy to change 8 to 7[/B] because the arrays are 0 indexed which it turns out I didn't change 8 to 7 or add a -1 to my rand's in the cpu ship chooser which fixed the problem except sometimes it …

Member Avatar for Aliun
0
999
Member Avatar for dipusarkar
Member Avatar for vijaysoft1
Member Avatar for mrnutty
0
273
Member Avatar for soapyillusion

A couple suggestions (hint: they're all interrelated): 1. Add a bool variable (perhaps called "quit"). 2. Convert menu() to return something other than void 3. Add a switch case 4. Figure out how to keep calling menu() as long as the user wants to Those should start you in the …

Member Avatar for soapyillusion
0
290
Member Avatar for anshul09

Did you do a site search? [URL="http://www.daniweb.com/forums/thread259666.html"]Check this thread out.[/URL]

Member Avatar for Fbody
0
140
Member Avatar for corby

For starters, if you ask me, this looks like a poorly thought out throw together simply for posting purposes. I think you need to pay closer attention to what you are trying to accomplish. I would advise you to sit down with a pencil and paper and do some more …

Member Avatar for Fbody
0
148
Member Avatar for i_luv_c++

A much better post, too bad it's not in your other thread... Anyway... You would have to use [URL="http://www.cplusplus.com/reference/clibrary/cstring/strlen/"]the strlen function[/URL] to get the string lengths. Based on what I see, you should be able to get the rest.

Member Avatar for i_luv_c++
0
149
Member Avatar for i_luv_c++

You better double check your assignment. Either that or you you need to clarify your situation. What is the purpose of this program? It would wind up insanely large for the intended result... After that, [URL="http://www.daniweb.com/forums/announcement8-2.html"]read this[/URL].

Member Avatar for Fbody
0
78
Member Avatar for ashokkumarrsp
Member Avatar for Nick Evan
0
2K
Member Avatar for cassie_sanford

Um.... This thread is long dead and you haven't shown any effort. You're probably not going to get much help. [URL="http://www.daniweb.com/forums/announcement8-2.html"]Please read this[/URL], then start your own thread.

Member Avatar for Fbody
0
411
Member Avatar for AmigaCarolena

Use code tags, there are descriptions all over the site. You've been notified before. You can not cin to a numeric literal, it has to go to a variable [URL="http://www.daniweb.com/forums/post1132136.html#post1132136"]you were told that before[/URL]. If you want help, you need to listen to what people tell you.

Member Avatar for EngSara
-2
141
Member Avatar for mrinal.s2008

The issue is with your header files themselves, not the forward declaration(s). Your classes are getting defined multiple times, they only need to be defined once. Add macro protection / guards to your headers. [URL="http://www.daniweb.com/forums/post1114822.html#post1114822"]Here are a couple examples.[/URL] You will probably have to get rid of your forward declaration …

Member Avatar for Fbody
0
195
Member Avatar for zhaviere

You only need 2 for loops, not 3. Figure out a different way to initialize and increment what you have called z. And please start using [b][noparse][code=syntax] ... code tags ... [/code][/noparse][/b]

Member Avatar for mrnutty
0
2K
Member Avatar for corby

If you want to use a function as part of an output stream it has to return something. Neither lengthc() nor widthc() return anything. [edit] Ack!!!.. Ninja Narue!!...run!!

Member Avatar for corby
0
115
Member Avatar for JHus00

[QUOTE=JHus00;1131790]It wont compile! I know something is probably wrong with my if condition but im unsure of what. [CODE]if (weight > 200) shipping_cost = 49.95; else if (weight >= 100 & < 200) shipping_cost = 39.95; else if (weight >= 50 & < 100) shipping_cost = 24.95; else if (weight …

Member Avatar for JHus00
0
114
Member Avatar for corby

I can see 2 things. I'm only going to discuss the first, if you correct it properly, the second issue should disappear. Your member function Rectangle::calculateArea() really shouldn't have any arguments. It should use the information already contained within the class to determine its result, not passed in values. Passing …

Member Avatar for corby
0
113
Member Avatar for srinath3

First, it's not [icode]<iostream.h>[/icode] it's just [icode]<iostream>[/icode] Second, you don't have any namespace declared. You need to somehow activate the [B]std[/B] namespace so that you can use [B]cout[/B]. I'll leave the method to you, there are at least 3 options available to you. Third: [CODE]gamma(int a,int b,float c):alpha(a*2),u(a) { beta(c,c); …

Member Avatar for srinath3
0
171
Member Avatar for mmasny

When you define an overloaded constructor (such as a copy constructor), the compiler no longer provides a default constructor. You will have to explicitly define a PUBLIC default constructor.

Member Avatar for mrnutty
0
170

The End.