1,358 Posted Topics

Member Avatar for cogitoergosum18

All you have to do is enter them just like you see them. Just be mindful of your parentheses. For the series situation, you'll probably want to use a loop of some sort and just total up the user's input values. EDIT: You're kidding me, this thread sat for an …

Member Avatar for mrnutty
0
141
Member Avatar for parrishnewbie

Please figure out your [URL="http://www.daniweb.com/forums/announcement8-3.html"][B][COLOR="red"][noparse][CODE]...code tags...[/CODE][/noparse][/COLOR][/B][/URL], then maybe we can help. [CODE] #include <iostream> int main() { std::cout << "This looks nice, and is easily readable." << std::endl; return 0; }[/CODE] #include <iostream> int main() { std::cout << "This looks like dung, and isn't readable." << std::endl; return 0; } …

Member Avatar for Fbody
0
102
Member Avatar for binoo0324

All of your variables are declared as floats. Check your data types. Not every piece of data in a program is a floating-point number... You may also want to look at how you are using GrossPay.[QUOTE][CODE]FedTax = GrossPay * 0.20; StTax = GrossPay * 0.05; GrossPay = RegularPay + OvertimePay; …

Member Avatar for burcin erek
0
292
Member Avatar for |hex

I suspect this is a variation on [URL="http://www.daniweb.com/forums/thread312661.html"]your previous question[/URL]. This variant has the same issue as your previous one. If you are going to use a multi-word command, you need to use string manipulation functions to normalize it then break it up and analyze the individual parts of the …

Member Avatar for Fbody
0
178
Member Avatar for parrishnewbie

Speaking in terms of Logic, there are 2 basic loop types; the [B]determinate[/B] loop and the [B]indeterminate[/B] loop. A [B]determinate[/B] loop is a loop that must run X number of times. For example, you have 10 items and you need to do something to each of those 10 items. An …

Member Avatar for Fbody
0
152
Member Avatar for samuel_1991

[QUOTE=caged_fire;1333661]The warning seems accurate. I don't think you can simply return an array because what you are doing is (as the warning states) returning the address of buffer. You should perhaps try returning an array pointer?[/QUOTE] They are already returning a pointer, that's why there is an issue. You can't …

Member Avatar for samuel_1991
0
723
Member Avatar for Peter_morley

You haven't shared the class definitions (that I can see). Unless dateInception is a member of Actor, you should be getting a warning from your compiler about using an undefined object. Isn't this the same question you asked in [URL="http://www.daniweb.com/forums/thread311942.html"]your other thread[/URL]?

Member Avatar for Peter_morley
0
152
Member Avatar for LevyDee

I don't think I would actually make them part of my resume, but you will want to submit them as an enclosure or attachment. Just make sure you some how direct the Personnel Manager's attention to the attachment/enclosure. This would generally be accomplished in your resume's cover letter. Generally, the …

Member Avatar for VernonDozier
0
99
Member Avatar for |hex

You should be able to do something like this with basic string-manipulation functions. But, [URL="http://www.daniweb.com/forums/thread78223.html"]the information here is a little lacking[/URL]. I think a better description of the command format, how the command is interpreted, and some sample code are in order.

Member Avatar for |hex
0
370
Member Avatar for Exile_082

It's because all your response outputs are part of the default case of your switch. You only see them if you make an invalid selection. In addition, you only see them if you have ordered at least one (1) of the particular item reported. However, the structure of the program …

Member Avatar for Fbody
0
190
Member Avatar for muze

If you know your input stream is clear, you could just throw in some sort of blocking input read, like a [iCODE]cin.get()[/iCODE]. That will make the program wait until some sort of input shows up on the input stream.

Member Avatar for muze
0
135
Member Avatar for samm22

Does this code use the STL queue (looks like it) or a custom-written one? Either way, it sounds like you are either missing a header, or you haven't resolved your namespace properly.

Member Avatar for Fbody
0
260
Member Avatar for nimaid

I don't know if it will work, but try sending the '\a' character to an output some how. That's the escape/control character for "beep" in many environments.

Member Avatar for Fbody
0
246
Member Avatar for vello

Did you post all of your code? The error is flagging line 39, but find() is called on line 36 of your post... I see nothing wrong with that line. That being said, vidit is correct. You don't have a prototype for find() before main() so it doesn't know that …

Member Avatar for arkoenig
0
201
Member Avatar for effizy

What exactly is the title of Chapter 5? Can you share the exact wording of the question you are working on? Like StuXYZ mentioned, this definitely sounds like either an [I]Introduction to Vectors[/I] or an [I]Introduction to Arrays[/I] type of chapter. When working with arrays, you need to be mindful …

Member Avatar for effizy
0
127
Member Avatar for glenn612991

[QUOTE=prvnkmr449;1333887]If you don't want store that value then just use simple variable for getting input from user by using loop and and three other variable for storing sum [CODE] int number,total,total_positive,total_negative; total=0; total_positive=0; total_negative=0; cout<<"Enter 10 number:"; for(i=0;i<10;i++) { cin>>number; if(number<0) total_negative+=number; else total_positive+=number; total+=number; } [/CODE] Best Of Luck.[/QUOTE] …

Member Avatar for Vllinator
0
2K
Member Avatar for liran ritkop

I think that depends on your definition of "a little difference between them". Are there data differences, functional differences, or both? Do they have the same basic functionalities and just implement the functions differently? This sounds like a generalization/specialization relationship, which would tend to imply an inheritance structure, but more …

Member Avatar for mike_2000_17
0
128
Member Avatar for winnie89

You have carriage returns in the middle of your string literals, you can't do that. If you want the output to wrap to the next line, you need to insert a newline character '\n'.

Member Avatar for mitrmkar
0
213
Member Avatar for notmasteryet

[QUOTE=Ancient Dragon;1334721]Not harsh -- tough love :) Normally you will want to break down the problem into its simplest parts, then code them one at a time -- divide and conquer style.[/QUOTE] Amen! I would suggest you study algorithm writing. You will be more successful if you come up with …

Member Avatar for Fbody
0
357
Member Avatar for DaCaj

I see a couple things: [list=1][*]You can't initialize a floating-point constant inside your class definition, some compilers allow it for integral types though [*]You haven't declared "global" versions of your static member variables. In order for a static variable to work, you must provide a "global" declaration/initialization for it:[CODE]class Example …

Member Avatar for vidit_X
0
637
Member Avatar for nbaztec

How did you get this to even compile? I don't think either of those initializations is even legal.

Member Avatar for Fbody
0
118
Member Avatar for aviavyne

Then what you need to do is use a [URL="http://www.cplusplus.com/doc/tutorial/control/"]switch, or other similar logic/control structure,[/URL] to analyze what the user entered:[CODE] cout << "Here are your options:" << endl; cout << "1.\tOption 1\n"; cout << "2.\tOption 2\n"; cout << "3.\tOption 3" << endl; cout << "Enter an option: "; cin …

Member Avatar for Fbody
0
320
Member Avatar for Dazaa

I had a similar example in a book I just read (Beginning C++ Through Game Design). Perhaps try the same technique. First initialize i and j using values from your enums. Then when calling set() cast the values from int to either Value or Suit as necessary. From my book's …

Member Avatar for Dazaa
0
1K
Member Avatar for sera1989

Well, you only want the average to print once and that's after you have shown all the grades. If I'm reading this correctly, you have 5 students, each with 3 grades. Something of this nature should take care of it:[CODE] for each student from 0 to 4 { //begin student …

Member Avatar for Fbody
0
181
Member Avatar for usustarr

First, your declaration of badDrivePointer should probably be a pointer to a U32 object since that is what the vector is carrying, not ints. Additionally, according to your comments, a U32 is an unsigned type whereas an int is a signed type. Unless U32 is an inaccurately-named typedef for int, …

Member Avatar for usustarr
0
238
Member Avatar for aaronmk2

You are using rows and columns as the size values for the array declaration on Line 12 when they aren't initialized. This results in undefined behavior. In addition, per Line 6, TwoDimArray is a 2-dimensional array of ints. Then, assuming that rows and columns were properly initialized, Line 12 declares …

Member Avatar for Fbody
0
562
Member Avatar for saloth

[QUOTE=caged_fire;1333335]That is entirely dependent upon you. What if you add a word later that exceeds your limit? I would suggest you allocate the memory dynamically so that you don't have to worry about what array size will work best. Anyway, If the largest has 8 characters then you need an …

Member Avatar for ftl25
0
194
Member Avatar for ravi_shekhar06

[URL="http://www.daniweb.com/forums/announcement8-3.html"]Nice wall of improperly posted code.[/URL] [URL="http://www.daniweb.com/forums/thread78223.html"]What is it and why is it here?[/URL] *Post Reported*

Member Avatar for Fbody
-1
174
Member Avatar for harvybcn

By their very nature, files are slow, if you need a fast system, you should keep information that is frequently accessed in RAM. I would some sort of static data structure, then just keep pushing and popping pointers to your image objects. Just make sure you delete the popped object(s) …

Member Avatar for Fbody
0
184
Member Avatar for hurbano

That would be because you didn't associate your implementations for add() and printAlpha() to your class definition. You need to use the scope-resolution operator '[B]::[/B]', just like you did with your MyBST constructor.

Member Avatar for chiwawa10
0
133
Member Avatar for bmos31

I think you need to create the proper class definition first. Your initialization statement(s) on Line 19 don't match your class' constructor definition. I would be surprised if this compiles. [list=1][*]You need a semi-colon after the brace on Line 8. [*]You have not created the proper constructors. The compiler will …

Member Avatar for bmos31
0
167
Member Avatar for dkolcun

If you're only going to the hundredths place, try changing the epsilon to something larger, but still reasonable.

Member Avatar for dkolcun
0
113
Member Avatar for fire_

[QUOTE=fire_;1332686]Hello. I know this is lame questinon but what is multi-if syntax? Like this: [CODE]if (a == 0) doSometihng(); if (a == 1) doSomething(); else doElse();[/CODE] Or like this: [CODE]if (a == 0) doSometihng(); else if (a == 1) doSomething(); else if (a == 2) doSomething(); else doElse();[/CODE] I'm useing …

Member Avatar for Fbody
0
90
Member Avatar for Lerner

Here is a program, using your example structures, that will demonstrate for you:[CODE]#include <iostream> using namespace std; struct node { int data; node * next; }; struct myList { node * head; node * tail; int numNodesInList; //member functions etc, but no other member variables. }; const int LIST_COUNT = …

Member Avatar for Lerner
0
158
Member Avatar for hsquared

Your intent is a little confusing, it sounds like you want to add multiple items to the same element of an array. Which is not directly possible. You mentioned using a linked list to do this. This would work, but you would need an array of lists. Each element of …

Member Avatar for Fbody
0
141
Member Avatar for JDean89

As written, total() returns the value of sum, but that return value then gets discarded because you aren't doing anything with it. You have 2 options: [list=1][*]store it to a variable, then output the variable [CODE]int someInt = 0; someInt = total(num1, num2); cout << someInt;[/CODE] [*]output the return directly …

Member Avatar for JDean89
0
129
Member Avatar for Tusike

It's probably easier to beat because you wrote the algorithms yourself. Since you wrote them yourself, you know how they "think" and can exploit them. If you want to start translating it to C++, I would recommend an online tutorial of some sort. [URL="http://www.cplusplus.com/doc/tutorial/"]This is one of the first ones …

Member Avatar for Fbody
0
284
Member Avatar for RFID46616c73

The first issue that I see is your headers and header guards. You haven't properly #included them where necessary and you have only guarded "Dice.h", but you forgot to guard "DieRoll.h". This is generally how you want to do it: Object.h[CODE] #ifndef OBJECT_H #define OBJECT_H class Object { private: int …

Member Avatar for RFID46616c73
2
1K
Member Avatar for drspock

Try [URL="http://www.cplusplus.com/reference/stl/map/find/"]map::find()[/URL]. You should be able to get an analyzable result from that. Then, if you get a response that means "not found", you can call [URL="http://www.cplusplus.com/reference/stl/map/insert/"]map::insert()[/URL] to add the key you were checking for. The std::map container stores instances of the [URL="http://www.cplusplus.com/reference/std/utility/pair/"]pair<> data structure[/url] (a templatized struct). You may …

Member Avatar for Fbody
0
2K
Member Avatar for majeissh

Are you referring to the addition operator (operator+) or to any operator that takes only one operand? There are 4 ways to overload operators, and which specific method you use depends on if it's a [URL="http://en.wikipedia.org/wiki/Unary_operation"]Unary operator[/URL] or a [URL="http://en.wikipedia.org/wiki/Binary_operation"]Binary operator[/URL] and whether it's a member function or not. To …

Member Avatar for Fbody
0
225
Member Avatar for Stefano Mtangoo

As Milton mentioned, both struct and class exist so that C++ is backwards-compatible with C. Even though they function nearly identically, the "class" however, is an extension of the basic struct that allows C++ to continue to evolve and improve on the concept without breaking the backwards compatibility. [QUOTE=Schildt, "C++: …

Member Avatar for LordNemrod
0
102
Member Avatar for VBNick

@Nick Evan: [B]>>[iCODE]for(unsigned short i = n_elements - 1; i > 0; i--)[/iCODE][/B] That's a good idea, but with that the OP can't access element 0 of the array because the loop won't run. I don't like couning on the overflow, but I think a better answer would be to …

Member Avatar for William Hemsworth
0
172
Member Avatar for headedtomexico

[B]>>How could you write several thousands of lines without knowing this basic rule of C/C++?[/B] Having an off day? Maintaining/Modifying someone else's code? @op As Mike said, with that declaration, there is no such element known as One[31]. That would be element 32 of the array, but there are only …

Member Avatar for headedtomexico
0
126
Member Avatar for Peter_morley

Welcome to DaniWeb. This is a nice first post, good job. Keep it up. What you have posted is a function definition. When you write a function, how is the definition supposed to be formatted? [CODE] returnType functionName([parmType1 parmName1 [, ... [, parmTypeN parmNameN]]) { statements... [return returnValue;] }[/CODE] I …

Member Avatar for Fbody
1
192
Member Avatar for rowanmck

Can you use the extraction operator to pull floating-point values out of a *.csv without the commas messing up your ifstream? It seems like the stream would get corrupted by the invalid input character(s)...

Member Avatar for Fbody
0
438
Member Avatar for jelinky

I don't see it mentioned, so I'm going to add. When you are finding a minimum or maximum value, it is advisable to initialize your "lowest"/"highest") variable (whatever it happens to be named) to the first value of your set as opposed to 0 or some arbitrary value. This simple …

Member Avatar for Fbody
0
132
Member Avatar for ScalesTech

Can't help much for 2 reasons: 1. [URL="http://www.daniweb.com/forums/thread78223.html"]Is there supposed to be a question in there somewhere?[/URL] 2. [URL="http://www.daniweb.com/forums/announcement8-3.html"][B][COLOR="red"][noparse][CODE]...code tags...[/CODE][/noparse][/COLOR][/B][/URL] are your friend. [INDENT][CODE] #include <iostream> int main() { std::cout << "This looks nice, and is easily readable." << std::endl; return 0; }[/CODE] #include <iostream> int main() { std::cout << …

Member Avatar for ScalesTech
-1
380
Member Avatar for bmos31

[URL="http://www.cplusplus.com/doc/tutorial/operators/"]I think you may want to make yourself familiar with the compound assignment operators (+=, -=, *=, etc...)[/URL] I'm sure you can do this with a nested loop and a simple "toggleStatus()" function.

Member Avatar for bmos31
0
825
Member Avatar for vbx_wx

It's just a multi-dimensional array of char... [CODE]//an array of char char charArray[80]; //an array of char* char* charpArray[80]; //OR //an array of arrays of char char mdCharArray[25][80]; //25 80-char arrays [/code] It's exactly like the main() parameter char *argv[] (which is another way to do it) Or did you …

Member Avatar for LordNemrod
0
133
Member Avatar for Frederick2

I don't know if VS2005 is the same, but in VS2008 you can go to [B][I]Edit->Bookmarks->Clear Bookmarks[/I][/B] to get rid of them.

Member Avatar for Frederick2
0
202

The End.