User Profile

Collapse

Profile Sidebar

Collapse
m013690
m013690
Last Activity: Oct 7 '06, 02:25 PM
Joined: Sep 30 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • m013690
    replied to Arrays and pointers
    in C
    to access a member in an array, you would use:

    array[ 4 ]

    to access the same item with pointer notation you could say:

    *( array + 4 )
    See more | Go to post

    Leave a comment:


  • m013690
    replied to decimal places for HW
    in C
    there is an output set mode function that works for floats as opposed to doubles.

    showpoint is the function, and it combines with setprecision. as in:

    cout << setprecision (3) << showpoint << 1.00;

    setprecision requires #include <iomanip>, and showpoint just requires #include <iostream>
    See more | Go to post

    Leave a comment:


  • m013690
    replied to whats the meaning of typedef
    in C
    no, the whitespace does not matter with regard to the pointer declaration.

    terms *express
    is the same as
    terms* express
    See more | Go to post

    Leave a comment:


  • m013690
    replied to c++n program
    in C
    You're learning file I/O and haven't even learned loops yet? That seems a little odd, but it's been a while for me. Anyone else think that's weird?
    See more | Go to post

    Leave a comment:


  • m013690
    replied to class problem in c++
    in C
    Great, glad to help. That's what these forums are for....
    See more | Go to post

    Leave a comment:


  • m013690
    replied to class problem in c++
    in C
    You would need to create a default constructor that takes no arguments, OR you could put default arguments into the constructor you do have, i.e.

    in your header file

    surf::surf ( int = 0, int = 0 );

    then in the .cpp file

    surf::surf ( int x, int y ) {
    // set your class variables to these values
    }

    what happens is that you can call the constructor with two variables,...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to How to return array
    in C
    Make your matrix a class with members that specify the dimensions...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to need for simple program of arrays
    in C
    double *dPtr[5] = new double[5];

    delete[ ] dPtr;...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to C++ Beginner
    in C
    Microsoft Visual C++ Express 2005 is available for free from their website, and it is a complete itengrated development environment. That means it includes the text editor as well as all the compile a debug tools built right into the same package. I know some people hate Microsoft, but it's free and it works well.
    See more | Go to post

    Leave a comment:


  • m013690
    replied to " assignment about linked list,stack,queue"
    in C
    Are you asking us to do the entire project for you? It's one thing to ask for help when you're up against a wall and you have a bug you can't find, but you sound like you haven't even tried anything yet and want someone to write the whole thing for you...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to Operation Overloading
    in C
    by overloading the '<<' function, you're teaching the compiler how to output an entire Queue object to the screen. So, somewhere in your printQ function, you just need this line:

    cout << theQ;

    When the compiler sees this, it generates the following function call:

    operator<< ( cout, theQ );

    Inside the overloaded '<<' is where you put all the hard work of walking through...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to Best Programming Language
    I got my feet wet in high school with Pascal, and it was a good intro to the basic concepts of control structures, logic, algorithms, functions, etc. In college they threw us right into C++ and I thought it was fine.

    I do agree with the guy who said "best" is a relative term, though, so it depends. I'm not in the industry, so it's hard to say in that regard, but I will add this: if you're just starting to learn, I don't...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to Operation Overloading
    in C
    In the function parameters list you listed the function name PrintQ. That should actually be a type (int, char, or in your case Queue). Then follow it with & theQ. Also, if you want to be able to use 'cout' in the normal way ( cout << theQ[c] ), your overloaded function cannot be a member function of the queue object, so unless the items you are printing are public members, the overloaded '<<' operator will not have direct access...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to a strange code i dont understand!!
    in C
    Is that because of the 'void'?

    In my first programming class (years back) they taught us to use void. It wasn't until several semesters later that I heard somewhere along the way that 'int' is considered better. Can't say I recall the reason though, but I'd be curious to hear if you have an explanation.

    Thanks,
    See more | Go to post

    Leave a comment:


  • m013690
    replied to I NEED HELP ---- REGARDING "IF" STATEMENT
    in C
    Q1: ( numberOfPrizes % numberOfPartici pants == 0 );

    Q2: ( widthOfBox % widthOfBook != 0 );...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to help required
    in C
    I think we need more info than that. Sorry. Be glad to help if you give a little bit more guidance.
    See more | Go to post

    Leave a comment:


  • m013690
    replied to Inserting in a list in Alphabetical order
    in C
    What you do, since it's a linked list, is you find the last item in the linked list (LL) that would come before the new entry. Now, in a LL, each item should have a pointer (or some other method of reference) to the next item in the LL (call this pointer NEXT). Also, for explanation's sake, let's call your three items A, B and N (for new).

    A and B are already in the LL, and A points to B as the next item in the LL. Create N (the...
    See more | Go to post

    Leave a comment:


  • I'd just do a simple for loop;

    First, create a temporary variable of whatever the type is for the list of items and initialize it to 0, or some appropriate value. Then, starting at the first list element,

    Temp = Temp + ListItem[index];
    or just Temp += ListItem[index];

    Once the for loop is finished, exit from the function Summation by returning the value of the temp variable you created.
    ...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to question about pointers???
    in C
    You CAN make just about anything a constant. But if you did that, you would have to initialize the pointers when you created them, and could never dynamically allocate more memory.

    This could be useful, though, because a pointer uses much less memory (potentially) than the object to which it points. That way, you could save yourself (potentially, again) A LOT of over head from passing arguments to functions.

    For instance,...
    See more | Go to post

    Leave a comment:


  • m013690
    replied to a strange code i dont understand!!
    in C
    Doesn't do much of anything productive, that's for sure. All it will actually do is continue allocating new memory until it has used up all that the system has available, at which point is will throw an exception and terminate program execution.

    It's not quite an infinite loop, in that it will finally exit when the system is no longer able to allocate more memory to the pointer 'p'. At that point, though, it will probably break out...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...