Search:

Type: Posts; User: rossipoo

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    1,056

    You've got the basics, now you need to use them...

    You've got the basics, now you need to use them to build up more and more until you have a complete solution. The next step is to make a function that evaluates a single term. Each term has this...
  2. Replies
    5
    Views
    1,481

    This is what I did and it ended up working good....

    This is what I did and it ended up working good. Thanks,
  3. Replies
    5
    Views
    1,481

    I don't have a list of perimeter points, I have a...

    I don't have a list of perimeter points, I have a list of elements (squares) from my 2d array that are touching the perimeter, and they are not in-order because I am using a recursive method to find...
  4. Replies
    5
    Views
    1,481

    Area Perimeter

    I have a two dimensional array with some of the elements marked, in essence like the image below. I want to calculate the points needed to draw an outline around the marked elements. In this case it...
  5. Replies
    3
    Views
    2,701

    You have all the right parts, yet the solution is...

    You have all the right parts, yet the solution is unnecessarily complex.

    A more concise solution. It only does one number, you should be able to make it repeat until the user types in an...
  6. Replies
    3
    Views
    2,701

    What's wrong here?: if (!prime) { cout...

    What's wrong here?:

    if (!prime) {
    cout << "The number is prime.";
    }


    There's probably more, but that's one thing.
  7. Replies
    2
    Views
    708

    The behavior of this program will not be correct...

    The behavior of this program will not be correct if only a one or two digit number is given.
  8. Replies
    5
    Views
    3,125

    I'm not sure how you are representing the maze...

    I'm not sure how you are representing the maze data. But you need to be keeping track of the steps you have taken as you traverse the maze. You could have an array, and each time you take a step, add...
  9. Thread: problem!!

    by rossipoo
    Replies
    3
    Views
    1,295

    The secret reffered to is a basic flood fill....

    The secret reffered to is a basic flood fill. Check Wikipedia.

    You need to iterate through every cell, and attempt to do a flood-fill for white. If it's successful, you add to a numberOfAreas...
  10. Replies
    7
    Views
    8,726

    What probably was wrong is that somewhere in the...

    What probably was wrong is that somewhere in the code that you have simply as ..... , you are changing the size of vector v. If you change a vector, any previously created iterators will become...
  11. Replies
    10
    Views
    13,647

    The code needed for drawing the top and bottom...

    The code needed for drawing the top and bottom rows is different than that needed for the middle rows. Therefore, it makes sense to separate it. It could be crammed into one loop, but it doesn't make...
  12. Actually, having a function call itself...

    Actually, having a function call itself recursively on invalid input is probably not the best method. Since you only want the instance with valid input to do anything, you may as well not be calling...
  13. Here is an illustration of how much using loops...

    Here is an illustration of how much using loops can improve the readability of code. I'll use loops and gotos to solve a simple problem, creating a multiplication table:

    Using for loops:


    for...
  14. Replies
    100
    Views
    5,924

    Not directly, but you can use a string inbetween:...

    Not directly, but you can use a string inbetween:


    char input;
    string inputString;
    getline(cin, inputString);
    input = inputString[0];
  15. Replies
    100
    Views
    5,924

    This could be because there is leftover in the...

    This could be because there is leftover in the input buffer after the cin >> input; line.
    Using cin for anything other than strings can be unreliable. You could try changing the line cin >> input;...
  16. Replies
    100
    Views
    5,924

    Can you tell why it's staying in the same room?...

    Can you tell why it's staying in the same room? You can use a debugger to find out exactly what code is being run when. If you pay careful attention to the output, the exact point at which something...
  17. Replies
    100
    Views
    5,924

    The logic could be reworked. Like so: while...

    The logic could be reworked. Like so:


    while (true) {
    // ... display possible directions for travel

    // Get input and decide where to go next.
    char input;
    cin >> input;
  18. Replies
    100
    Views
    5,924

    It's quite simple really. Assuming this is your...

    It's quite simple really. Assuming this is your current code to move north:


    player.location = player.location -> north;

    All you have to do is change it to:


    if (askQuestion () ) {...
  19. Replies
    100
    Views
    5,924

    Just like how you don't need a separate function...

    Just like how you don't need a separate function to move north for each room, despite the fact that north is different in each room, you also don't need separate question functions. Instead you need...
  20. Thread: if argv

    by rossipoo
    Replies
    2
    Views
    904

    argc (argument count) is an integer representing...

    argc (argument count) is an integer representing the total number of arguments, including the name of the application

    argv is an cstring array with the arguments, argv[0] is the first argument...
  21. Replies
    100
    Views
    5,924

    Oh, that probably means that the linked rooms are...

    Oh, that probably means that the linked rooms are not being initialized to zero. It was working for me in GCC, but it wasn't really proper coding; I should have added it before. To initialize them,...
  22. Replies
    100
    Views
    5,924

    Import? Don't worry about that, just use...

    Import?

    Don't worry about that, just use include. I copy-pasted out of my "Test" project I use for anything random like this, so there was other unrelated code. Otherwise you can actually compile...
  23. Replies
    100
    Views
    5,924

    You could expand a room to be whatever you like....

    You could expand a room to be whatever you like. You want to be able to move around inside the room? Have monsters? Treasure? It's all up to you. You cam see the o ly thing I implemented was a name...
  24. Replies
    100
    Views
    5,924

    Here is a simple room class and a navigating...

    Here is a simple room class and a navigating application:


    #import <string>
    #import <iostream>

    // A very simple room class
    class Room {
    public:
    string description;
  25. Replies
    13
    Views
    1,301

    There is an excess semicolon after main(), and...

    There is an excess semicolon after main(), and another after while(). Your code block brackets don't match. You always begin a block with {, and end with }. If you start, you must end it, therefore...
Results 1 to 25 of 38
Page 1 of 2 1 2