2,827 Posted Topics

Member Avatar for KungFuTze

Right off the bat, I see a few problems just in the very beginning: [code=C++] #include<iostream> //Librerias #include<cmath> //Librerias using namespace std; /* Function prototypes */ void Ingrades (double[][10], int); // Function that lets user input student ID, two partial exams one final, two quizzes and one project and studentCount …

Member Avatar for Stephen Ayayo
0
2K
Member Avatar for john_beginner

Here's a decent thread on the subject. Since you mentioned "DOS", I assume you really mean "Windows Console" since very few people use DOS now. [url]http://www.dreamincode.net/forums/showtopic9880.htm[/url] I couldn't get it to work for me, but I didn't play with it for all that long. It looked like it worked for …

Member Avatar for stultuske
0
13K
Member Avatar for zeLek

phoneNumber = toDigit(int & d) Two small problems. 1. Leave off the "int &". This is a function CALL, so leave off the type. 2. You forgot the semicolon. Try changing line 67 to this. phoneNumber = toDigit(d);

Member Avatar for VernonDozier
0
91
Member Avatar for nee_88

Does it compile? Does it run to completion? Does it crash? Where? What was the input? What was the expected output? What actually happened? Details, details, details. This one's pretty easy though. Let's take a look at gets. http://www.cplusplus.com/reference/clibrary/cstdio/gets/ char * gets ( char * str ); Further down on …

Member Avatar for Sokurenko
0
121
Member Avatar for VernonDozier

I have an abstract class. I'm creating a large array in the base class, which appears to never be deleted because no destructor is called. My questions (obviously) are... * Why isn't a destructor called? * How do I fix it? #include <iostream> using namespace std; class A { protected: …

Member Avatar for mitrmkar
0
271
Member Avatar for Dani

> Thankfully, disable ads was(is) not a paid feature Is this new with the update? I always thought it WAS a paid feature. Never noticed that little check-box till you mentioned it. How long's that been there? As to the fade effect, it annoyed the heck out of me until …

Member Avatar for Sahil89
0
843
Member Avatar for NunsBeachSurfer

How about making a temporary 3 x 4 array, initialize it as you have done, then in your for loop, do a memcpy of the 3 x 4 array to the address of element array[T][0][0]? const int temp[3][4] = {{4,2,6,4},{5,2,5,3},{6,3,1,5}}; int array[5][4][3]; // Replace line 3 in your original code …

Member Avatar for mike_2000_17
0
301
Member Avatar for coutnoob

A rectangle is a polygon with four sides where the opposite sides are equal. I imagine it would inherit everything that polygon has, plus add a constructor taking a length and a width and some getters and setters. Who wrote this code? > but i have no idea what i'm …

Member Avatar for Kanoisa
1
4K
Member Avatar for coutnoob

Your postings are all messed up with the line numbers. Where are you copying and pasting from?

Member Avatar for VernonDozier
0
224
Member Avatar for VernonDozier

I can't seem to copy and paste code form posts anymore. I get one big run-on line. The newlines no longer work. I also get all the line numbers, which means the code can't compile. Is there a "toggle plain text" option so I can copy and paste into an …

Member Avatar for Dani
0
181
Member Avatar for nathaniscool99

Delete lines 5 and 6. There are no floating point values anywhere in this problem. Line 8 - I assume you are trying to declare a 2 x 5 array? Shouldn't this be 2 x 4? That's what you have in your example. Change line 8 to this. char spaceLayout[2][4]; …

Member Avatar for adityatandon
0
8K
Member Avatar for Dean_williams

> copy the string from the first point in the file to the index of comma -1 Copy to where? Another file? A memory buffer in the program? Display on the console? If it's a memory buffer in the program, you'll need to allocate storage with malloc or something else. …

Member Avatar for Dean_williams
0
216
Member Avatar for FelineHazard

When in doubt, break it into several lines. Think about it. If it works, the increment has to happen after the assignment and the while test has to happen AFTER the assignment. Otherwise you'd either get complete garbage or miss the first or last character or miss the entire last …

Member Avatar for rubberman
0
665
Member Avatar for Lucaci Andrew

Sounds like another thread of the perils of mixing cin and getline. See this thread. http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream After line 8, there's an extra '\n' in the input stream. Line 10 gobbles that up and doesn't pause. Whenever you use getline immediately after cin with the >> operator, you need to get …

Member Avatar for Lucaci Andrew
0
281
Member Avatar for PuQimX

If you have three columns and the delimiter is a tab, I imagine the best way to handle it is to read the whole line, then use the find_first_of function from the string library with a '\t' as the character to look for. That returns the index of the tab, …

Member Avatar for PuQimX
0
160
Member Avatar for khuzdaar

Aside from all of the above, I'll add this. For checkers, you'd have to write a graphical user interface. You could write one without, I suppose, but I don't think it would look very good. All of the original checkers games were console, but we've gotten spoiled. For blackjack, a …

Member Avatar for khuzdaar
0
517
Member Avatar for NunsBeachSurfer

(B - A) / A can't be calculated unless A and B and the rest of the letters have numerical values, so that's a question even before getting to the array aspect of your question. I assume that all the types are doubles? You don't mention that. Best not to …

Member Avatar for NunsBeachSurfer
0
225
Member Avatar for volscolts16

[QUOTE=volscolts16;711208]I apologize I put the code between brackets but its not working is it b/c of the length?[/QUOTE] Code tags syntax: [noparse] [code] // paste code here [/code] or [code=cplusplus] // paste code here [/code] [/noparse] Note that there are no spaces between the opening and closing bracket pairs. The …

Member Avatar for deceptikon
0
4K
Member Avatar for VernonDozier

function validate_font_family($font_family, &$error_message) { $valid_match1 = '"Times New Roman",Georgia,Serif'; $valid_match2 = '"Arial",Georgia,Serif'; if(preg_match($valid_match1, $font_family) || preg_match($valid_match2, $font_family)) { return true; } $error_message = "Invalid font family(" . $font_family . "). Must be either "; $error_message .= $valid_match1 . " or " . $valid_match2; return false; } The code is supposed …

Member Avatar for VernonDozier
0
102
Member Avatar for mrnutty

I didn't see anywhere that specified the input filename, so I assume it is argv[1]? Here's my submission. I think it works if I understand the problem correctly. [code] #include <iostream> #include <fstream> #include <cassert> using namespace std; unsigned int Log2 (unsigned int number) // assumes number is greater than …

Member Avatar for nezachem
1
675
Member Avatar for dinosaur123

You need to narrow down precisely where the problems is. Several possiblities. * Input from the file is not successfully going into the objects. * Objects are not being outputted correctly. * All sorts of subsets of the above. * You have a whole bunch of "PS" variabes in there. …

Member Avatar for VernonDozier
0
427
Member Avatar for oscargrower11

If you're going for efficiency, make line constant and get rid of the calls to "compare". You're comparing one character strictly for equality, so just compare the characters... if(line[ss] == '=') // or any of the other comparisons The overhead of [] is negligible. There's some quick math to get …

Member Avatar for oscargrower11
0
182
Member Avatar for pattmorter

http://en.cppreference.com/w/cpp/language/operator_precedence You have a complex statement, Break it up into smaller statements using the order of precedence. It's an easy question. You'll get a is 0 even if you screw up the order of precedence. You have three statements, not necessarily in this order. Study the order of precedence and …

Member Avatar for VernonDozier
0
168
Member Avatar for n890

All sorts of ideas. Where are you stuck? The math? The programming? What part of the math? What part of the programming?

Member Avatar for VernonDozier
0
56
Member Avatar for Zorrro

The thread in question is a great example of a thread that SHOULD be ignored. The response that the first poster gave was a decent one in many respects, though I agree that it would have been better had the poster confined himself to simply explaining how the question needed …

Member Avatar for Zorrro
0
188
Member Avatar for ZaaZ

I can't get anything from the link, so it's hard to see the context. From what I can see, though, the function seems wrong. When I plug in 0 for an angle, it seems to me that no values should change (rotating a line by 0 degrees should have it …

Member Avatar for ZaaZ
0
597
Member Avatar for VernonDozier

http://www.daniweb.com/software-development/cpp/threads/421755/simple-2d-rotation-problem Scroll down to any of my posts with code. They don't have that nice numbering and highling everyone else's has. I wrote my code in a text editor, copied it to the post, highlighted it, then clicked "Code". I feel pretty confident I didn't click "Inline Code". Anyway, it …

Member Avatar for VernonDozier
0
225
Member Avatar for while(!success)

First you need to figure out prececisely where this is crashing. It can be any number of places for any number of reasons. Quickest, easiest way to find that out is to stick some debugging statements in various parts of the program, followed by some "cin.get()" calls to pause the …

Member Avatar for while(!success)
0
145
Member Avatar for Kirbyzdashiznit

You need to start over from scratch. Lines 39 to 42 show that you don't understand the difference between a single object and an array. You should also be using structures if you know them already. This function is a segmentation fault waiting to happen since you are using illegal …

Member Avatar for Kirbyzdashiznit
0
276
Member Avatar for pjh-10

main is a function, the loop isn't, but you are CALLING functions linke "sqrt" and "system". I'm guessing that's what they mean.

Member Avatar for VernonDozier
0
137
Member Avatar for tedtdu

>> How to send more than one file to command line arguments. "Send"? Send how? From where? I assume you mean fileNAMES, not files? You want to do something like this?? ./programname filename1 filename2 filename3 foldername then have the C++ code parse the command line argunments and dowomething with them? …

Member Avatar for WaltP
0
340
Member Avatar for Aneeque

1. Get rid of conio.h altogether. 2. Change iostream.h to iostream. 3. Change void main() to int main() and have the program return 0. 4. Replace getch() with cin.get(). See this thread... http://www.daniweb.com/software-development/cpp/threads/11811/replacement-of-getch

Member Avatar for VernonDozier
0
84
Member Avatar for greatman05

You have to supply a size, but it can be a "best guess" and you can always reallocate later if the guess was wrong. If it's user input from the console, I imagine a buffer of 100 would probably do the job without reallocation in most cases.

Member Avatar for greatman05
0
138
Member Avatar for Labdabeta

Add me to the people who can't reply to any message ever with IE 8. Now that I understand that's what the issue is, I'll just use another browser. Just replying FYI that for me it's been every single time over a space of days, so I doubt it was …

Member Avatar for Dani
0
311
Member Avatar for diafol

Who the hell would pay attention to a Rugby Tournament the day before the Super Bowl? Ask me Monday.

Member Avatar for happygeek
0
444
Member Avatar for chueymtz24

It's like a lot of things. Too many choices! Computer Science is such a rapidly evolving field with so many niches, you'll never learn it all and that's OK. Pick something that you are interested in and study that. For example, I have a friend who loves gaming and so …

Member Avatar for Josh12
0
165
Member Avatar for ilovephil

[quote] >>#define p printf >>#define s scanf Horrible misuse of macros. Don't be so lazy and just type out the word printf and scanf when needed. [/quote] Amen.

Member Avatar for Ancient Dragon
0
210
Member Avatar for TreeBranches

>> Hmm....is that allocating the size of a pointer to a char instead of the size of a char Well, sizeof doesn't allocate anything, but combined with malloc, yes you're allocating memory for 30 pointers, not thirty chars. I'm confused by line 16... [code] char** dictionary[words]; [/code] I can't tell …

Member Avatar for TreeBranches
0
219
Member Avatar for IcyFire

You might need to expand on what the user input options are and what needs to be done in different circumstances. You give "insert 3", but it sounds like there are other options as well. what are some of the other options?

Member Avatar for IcyFire
0
182
Member Avatar for ilovephil

How much time do you have? [url]http://www.daweidesigns.com/cgi-bin/pointers.php?page=3-0[/url] One is a pointer, one is an array. That pointer might potentially point to an array or it might not. In some cases a pointer can be used as if it was an array and in some cases it most definitely cannot.

Member Avatar for VernonDozier
0
60
Member Avatar for Swiftle

The first step in tracking down the problem would be to get more information on point number 3. [quote] 3)Finally, when attempting to access a specific value (within range) within a vector,I also get a crash.[/quote] If it's truly "within range", I don't see how it can crash. How do …

Member Avatar for VernonDozier
0
209
Member Avatar for techieg

[code] void Shoppingcart( string ); //constructor [/code] This isn't a constructor. If you think this is a constructor, you need to take a tutorial on classes, then come back to this. [code] int ShoppingCart::setStore( int pluCode, string prodName, int prodType, double unitPrice, double inStock) //constructor [/code] Neither is this. See …

Member Avatar for Lucaci Andrew
0
2K
Member Avatar for nekoleon64

I would change a few variable names, sticks some prepositions in there, or something like that. The variable names, while descriptive, aren't descriptive enough. I want to be able to read the probram and figure out whether the math flows correctly, but TilesBoxes could mean NumBoxesOfTiles, NumTilesThatFitInAInASingleBox, NumTilesInBoxes, etc. It …

Member Avatar for VernonDozier
0
282
Member Avatar for Yaguma

>> I am however getting linking errors such as-->[Linker error] undefined reference to `Database::AddStudent()' That's actually the one error you SHOULDN'T get. Are you sure you're getting it? Look at AddStudent. That's the one function that is correct, so model the others after it. The rest of them are wrong. …

Member Avatar for Yaguma
0
190
Member Avatar for nuclear

| is "bitwise OR". |= is bitwise-or and an assignment operator, just like +=, -=, %=, etc. Very often you'll have "boolean" type flags. My guess is that that is what WS_CHILD and WS_VISIBLE are. "ORing" them sets them as true, so I imagine ORing the WS_VISIBLE option means "make …

Member Avatar for VernonDozier
0
245
Member Avatar for zingwing

>> So far my code is counting all multi-letter words but not single letter words Try changing "a" to "ab" or any other multi-letter word. I see no difference in the count. Your problem is that you have used one test case and that test case has erroneously led you …

Member Avatar for zingwing
0
192
Member Avatar for sridhar.selva

Too vague to answer. What does "obtain the original values back" mean? You have a string and you can't extract the ASCII values? You can't display non-printable characters? The string is corrupted? You're not reading correctly from the serial cable? Etc.?

Member Avatar for sridhar.selva
0
240
Member Avatar for akaicewolf

If you can read it from a file, you should be able to read it from stdin, since stdin is a "file", as is everything. The question becomes, "How do I know when I am done?" You know when you are done in the file somehow. You need to have …

Member Avatar for VernonDozier
0
557
Member Avatar for shankhs

Slight modification. Put the cout in the if statement. I'm a little surprised that it works since strings end with '\n' rather than '\0', but it did. You don't want to display that last '\0'. That seemed to be the problem. [code=cplusplus] #include<iostream> #include<string> using namespace std; void rev_str(string str,int …

Member Avatar for venugopal.somu
0
504
Member Avatar for Cosa

[QUOTE=Cosa;592794]I am having trouble devising a method to multiply 2 matricies that are formed by dynamic one dimensional arrays, for this case i just used matrix1 and matrix2 To access elements that are on rows 0 to n-1 in either matrix i have to use this method: ((rows - 1) …

Member Avatar for kabultanha
0
4K

The End.