Search:

Type: Posts; User: Princeton

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    23
    Views
    2,104

    void main(int argc, char* argv[]) { ...

    void main(int argc, char* argv[])
    {
    printf("%d\n", x());
    getchar();
    }

    int x(void)
    {
    return rand() % 10;
    }
  2. Replies
    6
    Views
    2,231

    Both are worth having simply because they serve...

    Both are worth having simply because they serve different purposes. The former is a language reference that comes close to the C standard in accuracy while still maintaing an approachable air. There...
  3. Replies
    19
    Views
    2,590

    >I was already wondering why it was saying...

    >I was already wondering why it was saying "integer without a cast".
    That is a sign that a function is being used before its declaration. Without a declaration, functions are assumed to return int,...
  4. Thread: void

    by Princeton
    Replies
    3
    Views
    1,024

    >void add() = a function that has no return and...

    >void add() = a function that has no return and has an unspecified number of parameters.
    >int function(void) = a function that has an int return and no parameters.
    It really depends on whether or...
  5. Replies
    6
    Views
    1,437

    >arg= argument? >So whats the 'c' and the 'v'...

    >arg= argument?
    >So whats the 'c' and the 'v' after arg?
    argc == argument count
    argv == argument vector

    In theory you may name the arguments whatever you like, argc and argv are merely common...
  6. Replies
    6
    Views
    1,737

    >>Is it possable, that user types there file, and...

    >>Is it possable, that user types there file, and program would open/create file named file.txt?
    Yes, however you would be required to append the appropriate extension before opening the stream.

    ...
  7. Replies
    6
    Views
    1,737

    >>Google for 'ifstream' and 'ofstream'. With the...

    >>Google for 'ifstream' and 'ofstream'.
    With the extraordinary numbers of bad examples I would hesitate to suggest this. Perhaps a direct link to a well known high quality example would be better....
  8. Replies
    9
    Views
    2,036

    >>The ".h" header suffix has been phased out as a...

    >>The ".h" header suffix has been phased out as a c++ standard.
    conio.h is not a standard header, so that change does not apply.
  9. Replies
    28
    Views
    5,328

    >>what is the diference between the endl,flush...

    >>what is the diference between the endl,flush
    endl will print a newline and flush the stream, flush will not print a newline and flush the stream.

    >>this is the princeton's way!!!
    Well, it is...
  10. Replies
    28
    Views
    5,328

    >>so say if(!strcmp(m[],n[]) if (strcmp(m, n)...

    >>so say if(!strcmp(m[],n[])

    if (strcmp(m, n) == 0)
    Or the equivalent but arguably less clear


    if (!strcmp(m, n))

    However, in this case because the arrays are not terminated by a null...
  11. Replies
    7
    Views
    1,462

    >>if ((cfPtr = fopen("clients.dat","r") == NULL)...

    >>if ((cfPtr = fopen("clients.dat","r") == NULL)
    Your parentheses are not balanced. This is what you want.


    if ((cfPtr = fopen("clients.dat","r")) == NULL)
  12. Replies
    28
    Views
    5,328

    >>OH, it's a tip "int instead of void" or rule ?...

    >>OH, it's a tip "int instead of void" or rule ?
    It is a rule. The C++ standard requires main to return an integer except in very specialized implementations where it imposes no restrictions. The...
  13. Replies
    10
    Views
    17,422

    Did you remember to include windows.h?

    Did you remember to include windows.h?
  14. Replies
    12
    Views
    1,276

    Red Hat and SuSE both offer the parted utility if...

    Red Hat and SuSE both offer the parted utility if I recall correctly, so it is possible with both.
  15. Replies
    18
    Views
    2,320

    If you use the new headers then you must also...

    If you use the new headers then you must also remember that every standard name is embedded within the std namespace.


    #include <iostream>

    using namespace std; // Add this for the easiest fix...
  16. Replies
    12
    Views
    1,276

    If you can manage to acquire a second hard drive...

    If you can manage to acquire a second hard drive then it would be much easier to simply use that for Linux and leave the Windows drive unchanged. However, Mandrake does support a feature that allows...
  17. Replies
    18
    Views
    2,320

    >>int sum = ONE + TW0; The letter O can be...

    >>int sum = ONE + TW0;
    The letter O can be easily confused for the number 0. The define is TWO yet you used TW0. Feel free to change your viewing font if the two still look identical.
  18. Replies
    20
    Views
    6,139

    Yes, you are right. I should have been more...

    Yes, you are right. I should have been more specific so as to avoid bashing the tool. However if the design of a function does not lend itself to being used correctly then it most certainly is a...
  19. Replies
    4
    Views
    1,721

    >>What i was wondering is it possible to...

    >>What i was wondering is it possible to dynamically create these array[][] varibles
    Yes, of course.


    int **array = new int*[rows];
    for (int x = 0; x < rows; x++) {
    array[x] = new int[cols];...
  20. Replies
    20
    Views
    6,139

    >>but isn't that a problem with scanf then? Yes,...

    >>but isn't that a problem with scanf then?
    Yes, it is a problem with scanf. But it is not unique to scanf. The same problem can occur with any input function that reads a single character and does...
  21. Replies
    20
    Views
    6,139

    Try using the same solution after every call to...

    Try using the same solution after every call to scanf and see if the problem persists. scanf is a very complex function that is difficult to use properly even for experienced programmers. Once again...
  22. Replies
    20
    Views
    6,139

    Or better yet, modularize each operation into a...

    Or better yet, modularize each operation into a specialized function so a proper solution can be used without cluttering the main function. :)


    #include <ctype.h>
    #include <math.h>
    #include...
  23. Replies
    20
    Views
    6,139

    The problem is not necessarily with scanf, but...

    The problem is not necessarily with scanf, but character input in general. When you ask an interactive user to enter a single character, two are actually placed on the input stream. The first is the...
  24. Replies
    5
    Views
    1,051

    >>If classes only modified their own data -...

    >>If classes only modified their own data - wouldn't this limit all the cool stuff classes can do?
    Some would argue that the "cool stuff" is undesirable from a design standpoint. In my experience...
  25. Replies
    5
    Views
    1,051

    It is possible to have a reference member within...

    It is possible to have a reference member within a class, but you will need to take more care in the constructor because references must be initialized upon creation. Fortunately, a constructor...
Results 1 to 25 of 101
Page 1 of 5 1 2 3 4