Search:

Type: Posts; User: rc7j

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thread: _tmain()

    by rc7j
    Replies
    3
    Views
    2,391

    _tmain()

    Anybody know what the diff is between _tmain() and plain old main()? Where can I read about it? obviously I haven't been too successful finding anything.

    Thanks
  2. Replies
    4
    Views
    4,410

    #define vs. const

    This as an incomplete answer but might help.
    #define is a preprocessor facility used in C to define constants and macros among other things. The preprocessor goes through the source file and...
  3. Replies
    6
    Views
    9,664

    good idea

    That error checking is great. I will put it in my program. Thanks
  4. Replies
    6
    Views
    9,664

    It does not promote to double, Thanks

    I used the following code to check it. THey are floats in the end.

    cout << sizeof(float) << "double" << sizeof(double) << " element " <<
    sizeof(ary2Sort[0]) << endl;

    THe output was...
  5. Replies
    6
    Views
    9,664

    Thanks

    Thank you. The program does run fine.
  6. Replies
    6
    Views
    9,664

    using cin to get a float

    I can't get cin to take a type float from the keyboard. I am entering them into an array with a for loop but when I put an 'f' at the end to indicate a type float I get kicked out of the loop. If I...
  7. Replies
    2
    Views
    1,745

    thanks for yor help

    That works. Thanks.
  8. Replies
    2
    Views
    1,745

    function call as a 'case' arguement

    is it possible to use a function call as a case argument in a switch statement?

    Ex.

    switch (ch) {
    case isdigit(ch): /* runtime error 'not a constant' */
    ...
  9. Replies
    1
    Views
    2,338

    type cast a pointer to void

    How do I type cast a pointer to void so I can use it in a loop?

    void *smMacroPtr;

    for(fooPtr = (int *)foo; fooPtr < (int *)(&foo+1); ++fooPtr, ++((int*)(smMacroPtr)))
    if (smMacroPtr !=...
  10. Replies
    1
    Views
    2,557

    ? passing multi dimensional array to function

    The function call: " printAverage(dArray);" produces an error. The Visual c++ error message is: "cannot convert parameter 1 from 'double [3][2][5][2]' to 'double'"

    'dArray' in its decayed form...
  11. Replies
    2
    Views
    3,426

    thanks

    That is where the error is. SB: #define elements(array) (sizeof(array)/sizeof(double))
  12. Replies
    2
    Views
    3,426

    type 'double' unexpected?

    why does the line: "cout << elements(dArray);" in main() produce a compiler error saying "type 'double' unexpected"? I am using Visual C++.

    #include <iostream>
    #include <cstdlib>
    using...
  13. Replies
    2
    Views
    2,719

    type cast

    Got it, thanks. It compiles OK.:cool:
  14. Replies
    2
    Views
    2,719

    type cast to a pointer....

    anyone know how to -
    "type cast to a pointer to a pointer to an array of 3 floats"?

    I came up with -
    float (**(type cast))[3];

    What goes in the type cast parins?
    This is supposed to...
  15. Thread: strings

    by rc7j
    Replies
    1
    Views
    1,310

    strings

    Why does the 'getline(cin, ownerName);' and the 'cin >> ownerName;' cause the user to be kicked out of the program. It continues to print the 'cout' statements but allows no more input.

    #include...
  16. Replies
    2
    Views
    1,378

    try - if (type == "presidential") more...

    try -

    if (type == "presidential")
    more stuff


    also you could use a switch statement here.
  17. Replies
    5
    Views
    10,512

    That's the book. no cd-rom. source code for...

    That's the book. no cd-rom. source code for examples in the book are supposedly on the internet at http://www.brookscole.com/compsci/bronson/cpp

    I haven't been there.
  18. thanks. that works. Now how do I allocate space...

    thanks. that works. Now how do I allocate space without specifying the length of the string - like making a ragged array? ref. the '*name' pointer in the struct definition.
  19. how do I populate a structure containing a ptr with user input?

    The following code sets up an array of structures that is partially populated. one of the members is a pointer to a string (lunch[i].name). How do I populate the rest of the structure by user input?...
  20. Replies
    5
    Views
    10,512

    "A First Book of C++" by Gary Bronson was my...

    "A First Book of C++" by Gary Bronson was my first textbook. It has a lot of exercises and answers to the odd number question.
  21. Thanks you all for your help. I got the program...

    Thanks you all for your help. I got the program to work.:)
  22. thanks, still no joy

    thanks, I tried both suggestions, same results. Must be somewhere else?

    #include <iostream>
    #include <cstdlib>
    using namespace std;

    float lowestSales(float *salesTotAry, int salesPer);
    ...
  23. does not evaluate to a function - anyone know why?

    lowestSales(salesTotAry[0], salesPer);// function // call does not evaluate to a function
    // The function is:
    float lowestSales(float *salesTotAry, int salesPer)

    the perameters match up
    ??
  24. Thanks, this code works with one exception. The...

    Thanks, this code works with one exception.
    The output for:
    if (s1 < s2)
    return -1;
    if (s1 > s2)
    return 1;
    is backward.
    EX: s1="a" compared to s2="B" shows a < B.
    Using...
  25. runtime error

    Thanks. This code will compile but produces a runtime error
    /*This program uses a function to compare strings
    */

    #include <stdio.h>

    int myStrcmp(const char *s1, const char *s2);

    int...
Results 1 to 25 of 28
Page 1 of 2 1 2