Forum: Computer Science Feb 23rd, 2005 |
| Replies: 1 Views: 4,773 Sign-magnitude is probably the simplest of the binary representations. To get the negative binary representation of a negative number, just take the positive number and set the sign bit.
81 is... |
Forum: C++ Feb 23rd, 2005 |
| Replies: 11 Views: 3,507 Try:
Triangle Copy(Triangle t)
{
return Triangle(t.side_1, t.side_2, t.side_3);
} |
Forum: C++ Feb 23rd, 2005 |
| Replies: 10 Views: 3,347 a[0] is the first object. Don't forget that arrays in C++ are zero based. But yes, a two dimensional array can do what you want. |
Forum: Pascal and Delphi Feb 22nd, 2005 |
| Replies: 3 Views: 4,629 How you print the table depends on how you set up your table of records. If it's actually an array of records then you're looking at a loop like this:
writeln('Summary of Student Course Scores:')... |
Forum: C++ Feb 22nd, 2005 |
| Replies: 11 Views: 3,507 Sure, but be warned that I'm very busy during work hours, so I may not get to your question until tomorrow evening if I miss it tonight. |
Forum: C Feb 22nd, 2005 |
| Replies: 0 Views: 1,427 Unlike a balanced skip list, a probabilistic skip list uses random numbers to determine the height of each node rather than deterministic logic. The only real advantage of using a linked structure... |
Forum: C Feb 22nd, 2005 |
| Replies: 0 Views: 1,424 Array based skip lists are a pain to work with. They are error prone and difficult to follow. Worse, they are difficult to extend so that the data structure is deterministic rather than probabilistic... |
Forum: C++ Feb 22nd, 2005 |
| Replies: 11 Views: 3,507 Post the errors. Most likely we're using incompatible compilers where stuff like new headers and namespaces work for me but not for you. |
Forum: C++ Feb 22nd, 2005 |
| Replies: 10 Views: 3,347 Do the requirements say that the user should be able to create up to 10 Set objects, or up to 10 named Set objects? It appears to me like you can just have an array of Sets:
Set a[10];
int n = 0;... |
Forum: C++ Feb 22nd, 2005 |
| Replies: 11 Views: 3,507 Compare the operator== and operator<< functions between your version and mine. Therein lies the problem. Both Triange and friend should be removed from the front of the function tags, and Triangle is... |
Forum: C++ Feb 22nd, 2005 |
| Replies: 11 Views: 3,507 Compare this with what you have:
#include <iostream>
using namespace std;
class Triangle
{
public:
friend Triangle Copy(Triangle triangle1); |
Forum: C++ Feb 22nd, 2005 |
| Replies: 11 Views: 3,172 As long as the structure is correct for your project, you shouldn't get any errors. The nice thing about IDEs is that they package all of your tools together, but they also let you structure multiple... |
Forum: C++ Feb 22nd, 2005 |
| Replies: 19 Views: 4,045 You can probably PM cscgal and get her to remove your account. |
Forum: C++ Feb 21st, 2005 |
| Replies: 1 Views: 1,571 Look into the random_shuffle (http://www.dinkumware.com/manuals/reader.aspx?b=p/&h=algorith.html#random_shuffle) function. It takes a sequence and permutes the contents randomly. |
Forum: C Feb 21st, 2005 |
| Replies: 2 Views: 4,270 What errors you are getting? It compiles and runs just fine for me except every prime is 1 larger than it should be because you add 1 to m when printing. |
Forum: C++ Feb 21st, 2005 |
| Replies: 1 Views: 2,802 No, not really. But you can minimize the redundant code by putting all of this in a function:
void clear_data(data obj)
{
piplus.px.clear();
piplus.py.clear();
piplus.pz.clear();
... |
Forum: C++ Feb 21st, 2005 |
| Replies: 10 Views: 13,854 |
Forum: C++ Feb 21st, 2005 |
| Replies: 1 Views: 1,811 One word: "pipe". :) Any input to and output from the program can be piped into your GUI code and handled accordingly. |
Forum: C++ Feb 21st, 2005 |
| Replies: 11 Views: 3,172 To compile the code you only need declarations. But to link the object files into an executable, you need the definitions. :) The conventional way of doing this is by having a .h file with... |
Forum: C++ Feb 20th, 2005 |
| Replies: 9 Views: 139,568 A 20 character long hexadecimal value would exceed any of C++'s types. Try an arbitrary precision library such as GMP (http://www.swox.com/gmp/). |
Forum: DaniWeb Community Feedback Feb 20th, 2005 |
| Replies: 11 Views: 2,919 Always. Geeks are a strange bunch, but we always welcome new people into our fold. The only requirement is a desire to learn. :) |
Forum: C++ Feb 20th, 2005 |
| Replies: 9 Views: 139,568 That is up to your implementation, but you can assume that the size of an int is the natural word size of your system. A 32 bit system will most likely have 32 bit integers, so the largest value is... |
Forum: C++ Feb 20th, 2005 |
| Replies: 11 Views: 3,172 You should include myclass.h. Headers are there to provide declarations so that the code in multiple source files will compile. You do not need definitions until link time. You can include... |
Forum: C++ Feb 20th, 2005 |
| Replies: 1 Views: 3,116 You probably want to use == instead of =. The former is comparison and the latter is assignment. Aside from that, your loop seems to work okay. What exactly are you trying to do? |
Forum: C++ Feb 20th, 2005 |
| Replies: 5 Views: 11,200 There is, but it is broken. :) As I said before, the best way is to use the return value of your input function as a loop controller. |
Forum: C++ Feb 20th, 2005 |
| Replies: 1 Views: 1,250 A structure chart is just a flowchart (http://en.wikipedia.org/wiki/Flowchart). Pseudocode (http://en.wikipedia.org/wiki/Pseudocode) is equally simple, it is just a structured way of describing your... |
Forum: C++ Feb 20th, 2005 |
| Replies: 2 Views: 2,238 If possible, it's a good idea to use existing libraries to do your work. For example, the C++ library supports next_permutation that can be used to get the result that you want:
#include... |
Forum: C++ Feb 20th, 2005 |
| Replies: 8 Views: 1,833 I see you have already gotten another book, so feel free to ignore this post. I'm not a big fan of the "X for Dummies" books, but I have heard some knowledgeable C++ists sing praises for the most... |
Forum: C++ Feb 20th, 2005 |
| Replies: 5 Views: 11,200 The best way to read from a file is to use the input gathering function itself as your loop condition. That way when it returns a failure code (supposedly for reaching end-of-file), you break the... |
Forum: C++ Feb 20th, 2005 |
| Replies: 19 Views: 4,045 When first learning, it's most important to have a compiler you're comfortable with. Professionals can debate the merits of this compiler vs that compiler, but in the end if it's awkward for you to... |
Forum: C Feb 20th, 2005 |
| Replies: 3 Views: 2,061 Perhaps you meant
fin=fopen("a:\\test.txt","wt");
and
fin=fopen("a:\\test.txt","rt"); |
Forum: Legacy and Other Languages Feb 10th, 2005 |
| Replies: 90 Views: 28,859 program pascal;
begin
writeln('Hello, world!');
end. |
Forum: C Feb 10th, 2005 |
| Replies: 6 Views: 2,741 fprintf(fp_setup, "%s %4d %2d %c\n",
customer->customer_name,
customer->customer_no,
customer->no_of_weeks,
customer->tv_type); |
Forum: C Feb 9th, 2005 |
| Replies: 8 Views: 9,919 No. That's all there is to it, but the forum requires at least 10 characters in a message. :) |
Forum: C++ Feb 8th, 2005 |
| Replies: 2 Views: 5,644 You need an object of class secret or to derive from secret before you can access it's members. Just because you define a friend doesn't mean the rules of C++ have changed.
#include <iostream>
... |
Forum: C++ Feb 5th, 2005 |
| Replies: 1 Views: 3,677 No, executables compiled for one operating system are highly unlikely to run on another. |
Forum: C++ Feb 3rd, 2005 |
| Replies: 3 Views: 25,099 Is there something wrong with this?
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
double a = 440; |
Forum: C++ Feb 3rd, 2005 |
| Replies: 1 Views: 7,332 Your compiler is assuming a function returns int if you don't specify a return value. That's not technically legal C++, but many compilers support it anyway. Here is your code with the necessary... |
Forum: C++ Feb 1st, 2005 |
| Replies: 5 Views: 1,736 I think the intelligent solution would be to read the standard. But I can see how it would be intimidating to some people. Have you tried searching www.dinkumware.com? |
Forum: C Jan 30th, 2005 |
| Replies: 2 Views: 6,755 What you have should work, unless I'm too tired to see a problem. Another way to write it would be
inData.open(fileName.c_str());
for (int i = 0; inData>> T[i]; i++)
++size; |