• Member Avatar for gerard4143
    gerard4143

    Replied To a Post in Stock program help needed

    Try something like this. void displayTruck() { for (size_t i = 0; i < counter; ++i) std::cout << itemPtr[i]->getMaker() << itemPtr[i]->getCost() << std::endl; }
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in How to put this into a function?

    Then pass it as a reference. Something like this #include <iostream> #include <string> void replaceAll(const std::string & oldString, const std::string & newString, std::string & original) { size_t n = 0; …
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in How to put this into a function?

    Well the question I would ask is - Do you want to modify a variable past to this function or do you want to return a variable created by this …
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in How to put this into a function?

    Since replaceAll() returns void and doesn't change any global variables or state. What does this function accomplish?
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in Array Problem

    Instead of looping throught the arrays, I would try a function like memcmp().
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in templates and class's

    Do you mean something 'ugly' like this? #include <iostream> template <class T> class me { public: me():t(0) {} void create_T_pointer(const T & v) { t = new T(v); } const …
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in templates and class's

    Do you mean a data member which is a template?
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in fscanf vs fgetc

    One small subtle point. fgetc() reads the next character from stream and returns it as an **unsigned char cast to an int**, or EOF on end of file or error.
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in fscanf vs fgetc

    How the hell would we know what you forgot?
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in help me

    This forum is not a free tutoring service or a homework completion site. Post your question clearly, post your code clearly indicating where the problem is and post any other …
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in Stacks need help on one part

    I think you'll find the answer here. Check the example. http://www.cplusplus.com/reference/istream/basic_istream/seekg/
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in C programming help

    It doesn't. It only totals Sunday's sales. If you want an average then you'll have to divide by 50 or have a running day count to divide with.
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in C programming help

    So I'm assuming that a line represents a week and each integer from left to right represents days - SMTWTFS. You should be able to sum the array elements over …
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in C programming help

    While I'm waiting for the text file snippet for (i=0; i<=50-1; i++) for (j=0; j<=7-1; j++) {} //should be for (i=0; i < 50; i++) for (j=0; j < 7 …
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in C programming help

    Could you post an example of the text file chocolates.txt?
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in recursive function

    Last hint. #include <iostream> unsigned long vowels(char ca[]) { if ( ca[0] == '\0' ) return 0; //decide if ca[0] is a vowel return 1 + vowels(++ca); } int main(int …
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in recursive function

    Here's a big hint which counts the characters. #include <iostream> unsigned long vowels(char ca[], unsigned long v_num) { if ( ca[0] == '\0' ) return v_num; vowels(++ca, ++v_num); } int …
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in Gcc check version of C89, C90, C99

    The GCC compiler has a switch -std which can determine the language standard. Try searching this link for the -std switch options. http://linux.die.net/man/1/gcc
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in LinkedList and ArrayList help

    So what is a ArrayList?
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in help me this ><

    Yeah, my bad. I was wrote the reply too fast.
  • Member Avatar for gerard4143
    gerard4143

    Replied To a Post in help me this ><

    Why? Because C++ demands that functions are defined before they are used but you can define your functions like so. double fIntoCm(double); int main() { ... } double fIntoCm(double dIn) …

The End.