1,358 Posted Topics

Member Avatar for xavier666

This assignment is all about polymorphism, which is an extension of inheritance. To create polymorphism you must declare a pointer to a base class object, then store a pointer to a derived class object in it. [CODE]LinkedList * new_add = new Stack;[/CODE] Once you have done that, you will be …

Member Avatar for Fbody
0
115
Member Avatar for miskeen

Put it in a header: structHeader.h [CODE] #ifndef STRUCT_HEADER //begin header guard #define STRUCT_HEADER struct someStruc { /* struct elements */ }; #endif //STRUCT_HEADER //end header guard[/CODE] Then #include the header in your other files classA.h [CODE] #include structHeader.h class A { /* class members */ };[/CODE] classB.h [CODE] #include …

Member Avatar for harris21
0
10K
Member Avatar for Fbody

I have seen in a couple of places that strstream objects are deprecated, but there are also stringstream objects. My compiler has 2 headers <strstream> and <sstream> and I don't know which is which. In light of this, which header should I use to produce more modern code? I suspect …

Member Avatar for Fbody
-1
159
Member Avatar for miturian

Vectors only resize if you call the [URL="http://www.cplusplus.com/reference/stl/vector/resize/"]vector::resize()[/URL] or [URL="http://www.cplusplus.com/reference/stl/vector/push_back/"]vector::push_back()[/URL] methods. If you are accessing/modifying the vector using the subscripting operator (i.e. vectorName[index]) they act just like a regular array and will cause segmentation faults. [URL="http://www.cplusplus.com/reference/stl/vector/"]More info on vectors in general.[/URL] edit: Wow, 1,000th post. Doesn't seem possible...

Member Avatar for arkoenig
0
185
Member Avatar for Venom Rush

Then that's exactly what you need. As you go through the rows, if a row with the appropriate ID exists, echo a 'checked="checked"' as part of the checkbox's <input /> HTML tag. That will make it render in a "checked" state.

Member Avatar for Venom Rush
0
121
Member Avatar for neelm

Good luck with your homework assignment. No one here will do it for you. Try it first, then we'll consider helping you fix your errors.

Member Avatar for hanvyj
-5
58
Member Avatar for Emily Banks

[QUOTE=Agilemind;1302921]And what is the real moral of this story: Don't use an insecure wireless connection for any personal information.[/QUOTE] Can I get an AMEN!!!?

Member Avatar for Fbody
1
371
Member Avatar for georgialucas

I can't give specifics because I don't know Maya or Mel, but there should be some sort of Software Development Kit (SDK) or Application Programming Interface (API) that you can interact with. Try googling "Maya API" and "Mel API" and see what you can come up with.

Member Avatar for Fbody
0
108
Member Avatar for aladar04

Nice job of spouting off your assignment, but you really haven't given us anything about your expectations for your program or any information about what is/isn't working the way you expected. Did you even bother to read it yourself? Your code is full of throws, but there aren't any try …

Member Avatar for cgcgames
0
325
Member Avatar for dchunt

A newline is a whitespace. Your ifstream object's read location should see it and automatically move to the next line and read the next value. Just be sure you don't add the line numbers like you appear to be showing, they will be read as additional input. Unless you somehow …

Member Avatar for cgcgames
0
113
Member Avatar for miturian

Are you somehow not dereferencing a pointer properly? This would result in displaying the physical memory address instead of the data stored at the address.

Member Avatar for miturian
0
353
Member Avatar for lafayettejohnso
Member Avatar for Fbody
-1
161
Member Avatar for Web_Sailor

The header <string.h> is the pre-standard version of the standard <cstring> header. This header is used for manipulating C-style strings (null-terminated arrays of char). To access the member functions of the built-in C++ string type, you need to use the header <string> instead. What are the contents of the file …

Member Avatar for Fbody
0
385
Member Avatar for hussey001

[QUOTE]Oops, I did that very wrong, sorry!! I'll repost if you want me to.[/QUOTE] NVM, common rookie mistake. I'm sure a mod will fix it soon enough, just be mindful in the future. Snippets are intended to be useful little chunks of code that you would like to share with …

Member Avatar for Fbody
0
108
Member Avatar for wizrad

[QUOTE=wizrad;1300914]So I have this really simple situation and I have no idea what is causing this error. This is the relevant bit: header: [code=c] class foo{ void bar(int n); } [/code] cpp: [code=c] #include "foo.h" foo::bar(int n){ }; [/code] And then, from the main function in a separate .cpp file, …

Member Avatar for Fbody
0
266
Member Avatar for Lukezzz

One nice thing about C++ is the way it interprets true and false. There are, of course, the keywords [COLOR="Green"]true[/COLOR] and [COLOR="Red"]false[/COLOR], but you can also use [COLOR="Red"]zero[/COLOR] vs. [COLOR="Green"]non-zero[/COLOR]. Zero is false, and non-zero is true. All you need is: [CODE] if (sftp->Connect(hostname, port)) { //perform your transfer if …

Member Avatar for Lukezzz
0
243
Member Avatar for helpme87

That means that you are somehow specifying the file name as "dateStr.txt" rather than using the contents of the variable dateStr. [URL="http://www.cplusplus.com/reference/clibrary/ctime/strftime/"]Perhaps this function will help.[/URL] Maybe try something like this?: [code] #include <ctime> #include <iostream> #include <fstream> using namespace std; int main() { const int MAX_CHARS = 25; time_t …

Member Avatar for helpme87
0
156
Member Avatar for sbrohee

It looks like you want a set of Node pointers. However, the way you wrote your declaration you are trying to use the '*' improperly. You are trying to dereference a Node object instead of declare a pointer. The '*' must be placed after the data type to declare a …

Member Avatar for sbrohee
0
355
Member Avatar for gpleonar

you do realize this thread is almost 6-years old... the OP has probably completely forgotten about it by now.

Member Avatar for harshmore
0
415
Member Avatar for cj232

Here's some help: 1. [URL="http://www.google.com/"]Do some research[/URL] [LIST=A] [*]Try "accumulators" [*][url="http://www.cplusplus.com/doc/tutorial/control/"]Do additional research on proper looping[/url] [/LIST] 2. Find a piece of paper 3. Find a pen 4. Begin writing an algorithm 5. Begin translating algorithm to pseudocode/code

Member Avatar for Stefano Mtangoo
0
128
Member Avatar for Ubermatik

Wow, a very nice first post. I just wish I could help. Unfortunately, I don't see anything ATM. All of your braces seem to be paired up properly, I don't see any missing semi-colons, and all of your parentheses seem to be in order. Perhaps you should add some parentheses …

Member Avatar for Ubermatik
0
101
Member Avatar for cgcgames

I'm having trouble understanding the phrasing of your post, but one of your issues seems to be that you're having trouble outputting to a file Concerning your file output situation, please read [URL="http://www.daniweb.com/forums/thread299887.html"]this thread[/URL]. It looks like that poster was having the same problem you are. [edit] BTW: Despite the …

Member Avatar for cgcgames
1
91
Member Avatar for mebob

I don't know if this will address your problem or not: [CODE]class point { int x; int y; int z; public: point(int=0,int=0,int=0); void prompt_values(); void disp_point(); double distance(point); int compare(point); } //<--- This is a problem //a semi-colon is required[/CODE] If you forget the semi-colon after the definition of a …

Member Avatar for mebob
0
272
Member Avatar for vidyasmani

It's called side effects, it is generally not a good idea to program statements like this because of the unpredictability of them. This unpredictability comes partially from operator precedence, but not entirely. The increment and decrement operators have higher precedence than multiplication, division, and modulus, and postfix versions have higher …

Member Avatar for arkoenig
0
106
Member Avatar for ganesh_IT

[URL="http://www.cplusplus.com/reference/clibrary/ctime/localtime/"]The term localtime is an existing symbol too.[/URL] I wasn't 100% sure at first, the syntax highlighting in your code block actually tipped me off... Probably better off using something a little more obfuscated, ?or even in a different language?. Perhaps use customTimeClass, leTemps (it's French, "the time") or something …

Member Avatar for Fbody
0
95
Member Avatar for heena sharma

I'll give you the benefit of the doubt and assume that's true, but I'm giving you a friendly warning. You really should have said that and posted your code sooner. You would have gotten better help because the post wouldn't have looked so "givemethecodez", which is frowned upon. That's why …

Member Avatar for Fbody
0
132
Member Avatar for lemonzipper

Streams use bit flags to hold certain information. To manipulate these flags, you need to use the bitwise operators and special constants. [URL="http://www.cplusplus.com/reference/iostream/ofstream/open/"]You need to use the BITWISE OR to combine multiple file access modes when opening a file stream.[/URL] One mode constant does not imply any other, they are …

Member Avatar for lemonzipper
0
258
Member Avatar for saransh60

[QUOTE=mike_2000_17;1287774]@Kanoisa (saransh, please ignore): >> //this shouldent work it should be delete [] ptr. For primitive types like char, it works fine. When dealing with objects with non-trivial destructors, if delete[] is not called it will not call the individual destructor of each element, but the overall memory is still …

Member Avatar for Fbody
0
135
Member Avatar for vinochick

[QUOTE=vinochick;1056620]Here is what I have so far. I understand the middle portion of it. I'm just having a hard time understanding which variables to stick in the voids. [CODE]#include <iostream> #include <iomanip> using namespace std; //function prototypes void getFahrenheit(); void calcCelsius(); void displayCelsius(); int main() { //declare variables int fahrenheit …

Member Avatar for Andreas5
0
1K
Member Avatar for mamabear

[CODE]std::string myString = "A string consisting of letters, ABC, and digits, 123"[/CODE] Or did you mean something more like this: [CODE] std::string myString = "ABC"; myString + " 123"; std::cout << myString << std::endl;[/CODE] I think you'll have to clarify...

Member Avatar for Fbody
0
80
Member Avatar for Luther von Wulf

There aren't really any "naming rules" per se. It's more a matter of common sense and personal preference. Many people will add a 'c' at the beginning of a class name to indicate that it's a class name. But, using bank accounts as a simple example, something like this would …

Member Avatar for mike_2000_17
0
184
Member Avatar for Duki

This probably showed up near the top on Google, but there is a lot of info in the reference section of [URL="http://www.cplusplus.com/reference/stl/"]cplusplus.com[/URL]

Member Avatar for Duki
0
74
Member Avatar for computerdummy30

That would work, but I suspect the OP is not familiar with those yet. If you're not exactly familiar with how a binary number system works, addressing the 2^0 condition would be rather confusing. Of course, this is completely dependent on what the OP has already learned, and the lesson …

Member Avatar for Fbody
0
111
Member Avatar for Saleh

[QUOTE=sadds;1201650]did the computer science teacher ask you it on a test?[/QUOTE] You bumped a 6-year-old thread for that????

Member Avatar for JCRARY
4
276
Member Avatar for crodriguez08

Take another look at your [B]default[/B] constructor: [CODE]Student::Student(){ gptr = new int[3]; }[/CODE] In this constructor, what is the size of the array?... It's the default size of 3... Perhaps writing it this way will make it easier to see what it is doing: [CODE] Student::Student(){ const int DEFAULT_SIZE = …

Member Avatar for crodriguez08
0
475
Member Avatar for jagan605

You need to change the name of watercar::go() to watercar::move(), that will address part of your issue since it will take care of the error mentioning the missing overload and inability to link. Once that is corrected, you will still have intent errors that need addressing. To address them, you'll …

Member Avatar for Fbody
0
560
Member Avatar for ThrustinDuffman

Since you keep saying "array", I wonder if you don't want a multi-dimensional char array? [CODE] char myCharArray [][80] = {"This is question 1", "This is question 2", "This is question 3", "This is question 4"}; [/CODE]

Member Avatar for ThrustinDuffman
0
166
Member Avatar for PDB1982

They control how accessible the members of a class are. It's a pretty easy google search. [URL="http://www.cplusplus.com/doc/tutorial/classes/"]Read this for more information.[/URL] edit: looks like firstPerson beat me to it...

Member Avatar for Knightly
0
557
Member Avatar for ThrasherK

There is truth to your instructor's statement. Nearly all programming languages are composed of keywords that implement datatypes, hardware control, logic, etc. The difference is the words and symbols that are used to implement the logic and the rules that the statements must follow. Logic is logic is logic is …

Member Avatar for Fbody
0
677
Member Avatar for adaniel058

Generally, I wouldn't be this blatant, but I think it warranted this time. Look at Line 72, the first line of your main(). [CODE] Phone thePhone(Andrew, Daniel, 4906996);[/CODE] You are trying to send Andrew and Daniel to the function. The problem is that C++ sees them as undeclared variable names. …

Member Avatar for adaniel058
0
115
Member Avatar for Aia

I didn't know him, but I had the privilege of interacting with him several times on the C/C++ forums. It was always immediately obvious that he knew what he was talking about. I really appreciated his style. He really knew how to set you straight without making you feel more …

Member Avatar for sureronald
9
625
Member Avatar for mrnutty

Inside Foo::doIt() you declare a new "this" pointer that is non-const, call it "newThis" then const_cast "this" to get the address of the current object. You then dereference "newThis" to access num and change the value. Can I show the solution here? I'm sure it's possible to do it without …

Member Avatar for Fbody
0
96
Member Avatar for ota1it1iuss

Split your program into a calculation loop and a display loop. Your calculation loop would be what you already have, minus the output statement (Line 13). Your display loop would be the same, but start at 0 and only have the output statement. Also, you need to be careful about …

Member Avatar for shabnamapi
0
423
Member Avatar for katokato

The variable gradez shouldn't be an array. All you have to do is declare it and initialize it to NULL. [CODE]char aChar = '\0';[/CODE] Then, after you get it from the user, verify that it's either 'A' 'B' or 'C' and simply increment it: [CODE]cin >> aChar; aChar += 1;[/CODE] …

Member Avatar for katokato
0
106
Member Avatar for pepemongo13

*Snore*..... Seen this one before. It's very easy if you actually try. It probably took you longer to type the post than it would have taken you to do the assignment...

Member Avatar for Fbody
0
461
Member Avatar for Rickay

Double-Quotes ( " " ) are used to enter "string literals". Single-quotes are used to enter a single character i.e. 'C' [CODE] std::string myString = "This is a string literal, it uses double-quotes."; char charString[80] = "This is also a string literal."; char myChar = 'C' //this is a char …

Member Avatar for Rickay
0
117
Member Avatar for gahhon

What have you tried so far? What kind of results are you currently getting? We can't even begin to help until we know what you have and what you've tried.

Member Avatar for gahhon
0
4K
Member Avatar for flyingguitar

It seems to be flagging line 13. On that line, should the "__signed" be a "signed"? I don't think I've ever seen it with the double underscore before...

Member Avatar for flyingguitar
0
113
Member Avatar for kneel

Are you trying to get the whole array or just a single element of the array from getValue(). Either way, you'll have to at least change the declaration and potentially the implementation. If you want the array, you have to return the pointer: [CODE] int[COLOR="Red"][B]*[/B][/COLOR] gimmeTheArray() { return arrayName; }[/CODE] …

Member Avatar for Fbody
0
125
Member Avatar for crapgarden

They both work because a char is really just a small int (1-byte instead of [I]typically[/I] 4-bytes). The difference is the way the system interprets them by default.

Member Avatar for Fbody
0
122

The End.