Recent content by John O' Meara

  1. J

    Comp Sci Creating ifstream variables at run time in C++?

    Thank you for your recommendations and patience. I have an old book on: "Programming with class A C++ Introduction to Computer science" that I only got around to this year looking at, I guess it is out of date, though I must say that I have found it interesting, but it doesn't do iterators and...
  2. J

    Comp Sci Creating ifstream variables at run time in C++?

    This is the linked list: class charList { char value[80]; charList *nextEntry; int count; public: charList() { count = 0; } charList(char *v, charList *next) : nextEntry(next), count(0) { strcpy(value, v); } char *getValue() { return value; } charList...
  3. J

    Comp Sci Creating ifstream variables at run time in C++?

    Hi chiro, thanks for replying. As the code I have written stands, it refuses to increment i in the for loop and it only adds the first file entered to the output file; so I was thinking that I needed a separate ifstream object for each input file. and so I thought that the code was wrong...
  4. J

    Comp Sci Creating ifstream variables at run time in C++?

    How do you make a number of input file streams, one for each input file so that can copy/append the contents of these files to one output file? The number of input files is only known at run time and varies from run to run of the program. The input file names are first stored in a linked list...
  5. J

    Assigning values to classes nested 3/4 deep

    Hi rcgldr, no I am not running my code on windows, but I also have a windows laptop. It is an idea to get it for the lp and use that as a backup when I run into trouble again. I will find it using a Google search? Thank you, rcgldr. Mark44, thank you for all your replies. Yes, "nested classes"...
  6. J

    Assigning values to classes nested 3/4 deep

    I have attached a two page pdf document, which gives an overview of what I am trying to do and the structure of the program in terms of five simple classes . You may tell me that what I'm trying to do in terms of the structure of the program is too complicated or not possible. But your help is...
  7. J

    Assigning values to classes nested 3/4 deep

    Thanks Mark44, I don't know how you did it and so fast, but the code looks a lot better now. Just to make the code more understandable and why it is structured the it is. I should show you the following tables: lists ** previous words[i] following...
  8. J

    Assigning values to classes nested 3/4 deep

    For the program segment please see attachment. THe program compiles and runs but gives the worng answer; its output is suppose to be like below, if you type in "Our second version of table" on a single line you should get: previous words[i] following...
  9. J

    Writing a recursive function to compute the Jacobi symbol

    Write a recursive function to compute the Jacobi symbol J(a, n), is defined for relatively prime integers a and n, a> o, \mbox{ and } n > 0 by the formula J(a, n) = 1 \mbox{ if a = 1, } = J(a/2, n)*(-1)^\frac{n^2-1}{8} \mbox{ if a is even, } =J(n \% a, a)*(-1)^\frac{(a-1)*(n-1)}{4} \mbox{...
  10. J

    Enum problem with the Towers of Hanoi

    Thank you D H for the trouble you went to solve my problem and the time required by you and the information/explanations given about g++ 4.1.2. I was thinking that 4.1.2 was old alright, but I didn't think that it was buggy, because it has worked fine up to now with me. Thanks again.
  11. J

    Enum problem with the Towers of Hanoi

    I am using g++ 4.1.2 (beta)on a RISC OS platform, but hasn't the gdb debugger ported, so it is an incomplete port as it stands; maybe that is what is wrong it is an incomplete port. I should report it as a bug to the porters to the RISC OS., I supose? Thanks again.
  12. J

    Enum problem with the Towers of Hanoi

    Sorry for leaving <iostream> out; I have all all of corrections included and I still get the same error and also get an ambiguous error for left, middle, and right in the overloaded operator<<(). Thanks very much.
  13. J

    Enum problem with the Towers of Hanoi

    A C++ computer science book gives the following program. But my compiler reports an error; "void towersOfHanoi(int): error: reference to 'left' is ambiguous". int lineNumber; enum pole { left, middle, right }; void towersOfHanoi(int n, pole start, pole temporary, pole destination) { if (n...
  14. J

    How do you access a pointer of a class nested in another class

    Thanks very much. That was the problem as regards not having defined an instance of grades. In regard to the initialization of allGrades I hadn't initialized it at all, although I thought I had. The program works fine with with either initialization type. Thanks for taking the time and...
  15. J

    How do you access a pointer of a class nested in another class

    It is working fine now. The lack of an instance of grades was the problem,I guess. I thought I had allGrades initialized the way I said I had, I actually had the initialization of allGrades left out altogether. Thank you for your time and going to the trouble of typing the program into your own...
Back
Top