User Profile

Collapse

Profile Sidebar

Collapse
enri
enri
Last Activity: Jan 23 '08, 04:43 PM
Joined: Feb 14 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • enri
    replied to Can you help me with stacks?
    in C
    Stack is a queue wich adopt a last-in first-out strategy.

    If you would like to use an array to implemet a stack, you have to keep in mind that:
    1] When you are inserting an element in the stack (push), you can write the element in the first available position of the array, making sure that the position is within the array dimension.

    2] When you are removing an element (pop), you are extracting the last element...
    See more | Go to post

    Leave a comment:


  • enri
    replied to i have problem with these program
    in C
    typos

    There are some syntax errors and some calls to non-existent functions.

    You should check that all constant strings you would like to print with fprintf are enclosed in quotes:
    fprintf(stderr, "This is an error );
    fprintf(stderr, "This is correct");

    and you should also check that all brackets are matched: whenever you open a bracket there must be the correponding closing...
    See more | Go to post

    Leave a comment:


  • enri
    replied to simple method
    in C
    Try here

    http://www.nr.com/...
    See more | Go to post

    Leave a comment:


  • enri
    replied to Compound Interest with recursion help
    in C
    mastern2000,

    this would probably do the trick:

    Code:
    double Compound(double capital, double interest, int months)
    {
         if (months==1)
              return capital*(1+interest);
         else
              return (1+interest)*Compound(capital,interest, months--);
    }
    See more | Go to post
    Last edited by enri; Feb 15 '07, 07:30 PM. Reason: indentation

    Leave a comment:


  • enri
    replied to error message help
    in C
    tedarr,

    have you tried using

    Code:
    this->objID
    to get the rectangle ID in the error-reporting functions?
    See more | Go to post

    Leave a comment:


  • enri
    replied to Book Library system
    in C
    What I would do is create three classes: one class for the book object, one for the customer object, and one class for the library, that is a collection of both books and one of customers, implemented as lists.
    Henceforth, my headers would look something like:

    Code:
    class Book{
    	private:
    		string Title;
    		string Author;
    		int ISSBN;
    	public:
    		Book *pnext;
    
    		Book();
    ...
    See more | Go to post
    Last edited by enri; Feb 15 '07, 07:01 PM. Reason: indentation

    Leave a comment:


  • enri
    replied to filebuf object Vc++
    in C
    The first line creates a new object filebuf by mean of its constructor "filebuf()" , and address it using a pointer to filebuf called "buf".
    Then a file name "log000000. txt" is initialized.
    The cyvle, checks if a file named "log000000. txt" exist, using the filebuf method open(). If it exist, it changes the file name to "log000001.txt" , and checks it existence, and son on incrementing the...
    See more | Go to post

    Leave a comment:


  • enri
    replied to gcc: static allocation of array with variable size
    in C
    Thank you all, very much,
    that shed some light.

    So, for what I understand, gcc uses C99 standard even when compiling plain C++, even if standard C++ does not support some of its features....
    See more | Go to post

    Leave a comment:


  • enri
    replied to gcc: static allocation of array with variable size
    in C
    For what I knew, static allocation, as "double vect[dim];", requires the compiler to know the dimension of the required memory at compile time. In my piece of
    code this is not the case.
    Am I right?

    To make things worse, the same code is not compiled by Visual C++, since the value of "dim" is not known......
    See more | Go to post

    Leave a comment:


  • enri
    started a topic gcc: static allocation of array with variable size
    in C

    gcc: static allocation of array with variable size

    Hi everyone.
    Is anybody able to explain to me why gcc will compile without the slightest warning the following code?

    Code:
    #include <iostream>
    
    int main()
    {
       int dim;
    
       cin>> dim;
       double array[dim];
    
       // operations on the array
    
       return 0;
    }
    See more | Go to post
No activity results to display
Show More
Working...