Search:

Type: Posts; User: ex-mortis

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    1,245

    std::string someString; while(someString !=...

    std::string someString;

    while(someString != "black"){
    while(!(std::cin >> someString)) /*Deal with error*/;
    std::cout << "1";
    }
  2. Replies
    24
    Views
    2,841

    Yeah, I know. I was only testing initial...

    Yeah, I know. I was only testing initial configurations for sequences I am familiar with. I have the simplelife iPhone app and I also checked a web-based Game of Life and when I said nothing was ...
  3. Replies
    24
    Views
    2,841

    Well that's embarrassing. My original copy...

    Well that's embarrassing. My original copy function was "copy this to this" whereas this one is "copy to this from this". It works perfectly now, though I have a lot more work to do (UI-wise). Thanks...
  4. Replies
    24
    Views
    2,841

    Excellent suggestions, my program is considerably...

    Excellent suggestions, my program is considerably more efficient. Although I tried at first to pass in the arrays as function parameters I couldn't get it to work. Never thought of using a typedef.
    ...
  5. Replies
    24
    Views
    2,841

    1. I'm not? What is the proper way to check for...

    1. I'm not? What is the proper way to check for an overrun then?

    2. I already tried it, it doesn't work. The error is definitely in the conditionals because they return false or don't run at all...
  6. Replies
    24
    Views
    2,841

    Sorry, that's not what I was trying to say. I...

    Sorry, that's not what I was trying to say. I simply commented erroneously that it wasn't a problem but that I was going to fix it. Is this adequate enough?


    // Scan adjacent cells for life
    int...
  7. Replies
    24
    Views
    2,841

    Makes sense now that I think about it. Thanks for...

    Makes sense now that I think about it. Thanks for the tips, I'll get to work.
  8. Replies
    24
    Views
    2,841

    Nope. See for yourself...

    Nope. See for yourself.



    Can you elaborate? I don't really understand.



    Hadn't considered it. At the moment I'm only testing the middle of the board so it isn't a problem, but I'll fix it.
  9. Replies
    24
    Views
    2,841

    Sorry. The Game of Life...

    Sorry. The Game of Life is a non-interactive "game" that is "played" on a grid with any number of cells (in my program it's 25x25). Each cell can either be "dead" or "alive" and the game has four...
  10. Replies
    24
    Views
    2,841

    Problem with Game of Life program

    #include <iostream>
    #include <cstdlib>
    #include <Windows.h>

    char grid[25][25];

    void turnOn(int x, int y);
    void turnOff(int x, int y);
    bool lhmt3(int x, int y);
    bool lh2o3(int x, int y);
  11. Nice spot. It's a little carry-over from my char...

    Nice spot. It's a little carry-over from my char array design that I forgot to fix actually. Although what it does at the moment isn't catastrophic having a copy is pretty much unnecessary. Thanks.
  12. Got it work just in case somebody else out there...

    Got it work just in case somebody else out there has a similar problem. This is the final loadGames() function:


    void loadGames(){
    std::string line, num_holder, title_holder, hours_holder;
    ...
  13. Well, I'm sorry. "At first I tried to read...

    Well, I'm sorry. "At first I tried to read directly into an int, std::string and double with no luck so I tried reading into character arrays and converting them to ints and std::strings with even...
  14. Like I said, I am not sure what types of...

    Like I said, I am not sure what types of variables to declare because I haven't found a method that works yet and so I omitted the declarations.




    Right now this code is completely...
  15. Reading from file stream using ifstream object and storing in a map

    void loadGames(){
    std::ifstream load("Gamelist.gl");
    num_holder;
    title_holder;
    hours_holder;
    load.getline(num_holder, 1, ' ');
    load.getline(title_holder, 20, ' ');
    ...
  16. Replies
    11
    Views
    3,836

    I just read through the "Why does my program...

    I just read through the "Why does my program enter an infinite loop if the user inputs invalid data?" entry that was linked to me and was better able to understand it now than before. So, now my...
  17. Replies
    11
    Views
    3,836

    I'm not just trying random stuff until something...

    I'm not just trying random stuff until something works, I just don't have a clue how cin works yet (though I have a vague idea now). This is actually the first program I've written in several weeks...
  18. Replies
    11
    Views
    3,836

    Well seeing as I don't know how to use exceptions...

    Well seeing as I don't know how to use exceptions I went back to the if statement method (which is what I tried to do first anyway and failed). It looks like this:



    int x;
    if...
  19. Replies
    11
    Views
    3,836

    So I shouldn't check for errors? Passing a string...

    So I shouldn't check for errors? Passing a string into std::cin >> *int* yields weird behavior. What I want is to reject all types save for integers. How would I go about that? I've tried catching a...
  20. Replies
    11
    Views
    3,836

    std::cin exception handling

    #include <iostream>
    #include <fstream>
    #include "MoneyManagement.h"

    int main ()
    {
    std::ifstream iMoney("money.txt");

    if(!iMoney){
    std::cout<< "Error opening file.\n\n";
  21. Replies
    18
    Views
    2,881

    Awesome, I get it. Thanks everyone. What...

    Awesome, I get it. Thanks everyone.




    What is the "Bridge" pattern?
  22. Replies
    18
    Views
    2,881

    Yeah, that makes sense. Still, it doesn't answer...

    Yeah, that makes sense. Still, it doesn't answer my question regarding the use of the pimpl idiom. Why is it necessary exactly?
  23. Replies
    18
    Views
    2,881

    Ah, I understand now. But how does using a...

    Ah, I understand now. But how does using a pointer to implementation help compilation dependency? It seems to me that if the implementation is located within the class, and the data members are safe...
  24. Replies
    18
    Views
    2,881

    How is it the same, exactly? I mean, assume we...

    How is it the same, exactly? I mean, assume we are just talking about int x = 9 and then later you change it to int x = 8. Hasn't the implementation changed? The pointer may remain constant, but...
  25. Replies
    18
    Views
    2,881

    Compilation dependency and the pimpl idiom

    So, I just read through Item 31 in Effective C++ and it confused the hell out of me. The idea is to minimize compilation on the client's part and I get why it's desirable, but I just don't see how...
Results 1 to 25 of 38
Page 1 of 2 1 2