I had originally programmed it that way. I had a data member that was a string which I used to pass to functions and stuff. She said that I shouldn't have to do that.
She said that my class...
Type: Posts; User: brianptodd
I had originally programmed it that way. I had a data member that was a string which I used to pass to functions and stuff. She said that I shouldn't have to do that.
She said that my class...
I'm not sure what the problems would be, this is for a class and I need to write the code this way. I am always into easier and better, but I don't think school operates that way.
Here is the...
I am writing a class derived from string for use as a field. All I really want (or need) to overload is the insertion and extraction so that I can read from a data file.
However, when I am trying...
I don't think it would be possible to print out the first and last lines, then lines in between....would it? The assignment is vague and only gives the output I originally posted and that a...
How does the function decrease the number of spaces indented?
In addition to the other requirements, each line must be indented one space, increasingly and decreasingly. It didn't show up in the post that way.
Brian
I need to write a program whose output looks like:
This line was output by call 1.
This line was output by call 2.
This line was output by call 3.
This line was output by call 4.
...
I have written a clock class, with an international clock derived class. I am having problems with the syntax for the constructors in the derived class.
Here is what I've got in the .h:
...
Thanks all!
Right. My bool tells me that if its true, it's AM, if it's false, it's PM. So if I advance my clock past AM or PM, I need to change from AM to PM, or true to false or vice versa.
I know I can do...
Can I switch a bool object from another function. I am writing a function that advances a clock a certain number of minutes.
If the hours end up being more than 12, I need to switch my bool...
That made things much worse. Should I be passing a pointer to the function?
I am trying to write a simple function that will print my array of clocks. I have a function called display_time() for the clocks:
void clock::display_time()
{
cout << "Current time is:...
I am trying to read data from a file and put that data into a link list. My problem is that even if the file is empty, my function still adds junk to my link list.
Here is the function to read...
I have written a field class that inherits from the string class, but I need to overload the << and >> operators to handle input/output to a file but I am having trouble with the implementation.
...
That helped a lot. I need to use a member function to perform the actual removing, but your algorithm helped me get mine straight.
Thanks.
Brian
I am trying to write a function that removes duplicates from a linked list.
Here is the code I have:
/*
* Function remove_dups()
*
How can I remove nodes with duplicate data from a linked list. I am having trouble writing the while loop.
but what if the node you want to remove is s? how do i access the previous->next that points to s, and switch that to s->next?
How do I remove an interior node from a singly linked list? I am using a node class with a double data member and a list class.
I am writing a clock class and am working on the operator overloading to compare two clocks, but my compiler is telling me:
"bool operator < (const Clock& c1, const Clock& c2) must take exactly...
I agree that would be a simpler and more direct solution. How would I get both my variables into the function in the first place?
Here is what I have so far:
#include <iostream>
unsigned long factorial(unsigned long n, unsigned long r); // function prototype
int main()
I am having trouble getting started writing a recursive function to calculate a factorial, like this:
n!/r!*(n-r)!
Where n and r and numbers entered by the user and the ! represents the...
perfect! thanks Magos