Dark_Necros's Profile User Rating: -----

Reputation: -7 Shunned
Group:
Active Members
Active Posts:
253 (0.13 per day)
Joined:
29-May 09
Profile Views:
6,278
Last Active:
User is offline Jul 04 2014 12:16 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   Dark_Necros !!!

Posts I've Made

  1. In Topic: [Q] I'm struggling a little with pointers

    Posted 28 Dec 2013

    View PostCTphpnwb, on 28 December 2013 - 11:43 PM, said:

    You're outputting the address of the object. Look at this example:
    #include <iostream>
    
    class example {
    	int number;
    public:
    	example()
    	{
    		number = rand() % 100;
    	}
    
    	int get_num()
    	{
    		return number;
    	}
    };
    
    int main()
    {
    	example *test[5];
    
    	for (int i = 0; i < 5; i++) {
    		test[i] = new example;
    		std::cout <<test[i]->get_num() << "\t" << test[i] << std::endl;
    	}
    
    	return 0;
    }
    


    It's not the output that I'm particularly interested in. I understand that it's the address of the object. That's what is intended for those lines. I'm interested in copying the address from one pointer to another. I'd like both myArray[0] and myArray[1] to point to the exact same object. I can't tell if that's what is happening here, because the address that is printed when I look at myArray[0] is different from the address that is printed by myArray[1].
  2. In Topic: [ncurses] Simple do...while not acting as expected. I'm curious wh

    Posted 15 Nov 2013

    Essentially I'm trying to accept a set of coordinates for a game. It requests again if the coordinates are out of bounds.
  3. In Topic: [C++] Insignificant bug is driving me crazy

    Posted 16 Jun 2013

    View PostNickDMax, on 12 June 2013 - 06:55 AM, said:

    next you use arrays which is not the best C++ practice. Arrays are more of a low-level operation in C++. Typically one would use a std::vector or (C++11) a std::array at the very least.


    I think I learned how I could initialize the array dynamically.
    constexpr int n()
    {
        return 10;
    }
    
    double a[n()]; // n() is a compile time constant expression
    
    



    I got that from here.
  4. In Topic: [C++] Insignificant bug is driving me crazy

    Posted 12 Jun 2013

    View Postjimblumberg, on 12 June 2013 - 10:21 PM, said:

    Then you should try to learn them, the sooner the better. Here's a couple of links to get you started: Data structures, Classes I and Classes II

    Jim

    Thanks for these. I'll get on them asap.

    Sent from my SCH-I535 using Tapatalk 2


    EDIT:

    View PostSarumanTheWhite, on 12 June 2013 - 10:55 PM, said:

    I managed to get the output looking right by replacing the << ".\n"; with << endl; although this is probably only masking the potential larger issues at hand.


    I'll keep this in mind. Why would it make any difference, though? Isn't endl just a '\n' in a variable? I looked it up, and the reason it fixes things is because it flushes the stream.
  5. In Topic: [C++] Insignificant bug is driving me crazy

    Posted 12 Jun 2013

    View Postjimblumberg, on 12 June 2013 - 08:33 PM, said:

    Quote

    As with vectors, I had yet to learn classes. That was going to be the next thing that I learn after sequential access files.

    What about structures. Many times using a structure or class to hold the items being read from a file is a great help in keeping things simple.

    Jim

    As with vectors and classes, I understand what they are, but not how they're implemented in C++.

My Information

Member Title:
D.I.C Regular
Age:
20 years old
Birthday:
September 26, 1993
Gender:
Location:
United States
Full Name:
Landon R. Brainard
Programming Languages:
C++

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://redshyft.com
Skype:
Skype  brainard52
Facebook:
http://www.facebook.com/DarkNecros

Friends

Comments

Dark_Necros has no profile comments yet. Why not say hello?