Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
S

Sivyo

@Sivyo
About
Posts
26
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem with get/set method [modified]
    S Sivyo

    well, apparently something was wrong with that computer. I was working with it at school and now that I am home, the program works fine. Makes me feel really stupid.... worked 4 hours on that thing and the problem was with the computer. i didn't get anything done....

    C / C++ / MFC help question

  • Problem with get/set method [modified]
    S Sivyo

    noticed when moving around the protected names...

    protected:
    string m_weight;
    string m_name;
    string m_gender;

    the problem moves to gender. ect... very very strange

    C / C++ / MFC help question

  • Problem with get/set method [modified]
    S Sivyo

    noticed (with some help from inside sources) that in the problem is with the compiler for some odd reason it doesn't like creating a 3rd variable of string in Animals. I moved weight be to be first and name was last (3rd) then it showed Bad ptr message in the debugger. its a very strange error....

    C / C++ / MFC help question

  • Problem with get/set method [modified]
    S Sivyo

    I don't actually know how to use the call stack window. I will google it see if that will help. I did debug it and create break points and it always crashes right after set weight. I checked out the watch. and everything goes where it is supossed to but then it just crashes right after everything is set. I commented out set weight and it seems that is the problem, it doesn't crash if I take it out

    C / C++ / MFC help question

  • Problem with get/set method [modified]
    S Sivyo

    I modified my origional post. Its all up there

    C / C++ / MFC help question

  • Problem with get/set method [modified]
    S Sivyo

    the debuggers shows me this window and shows me where it stops... LeadUp1: and edx,ecx ;U - trailing byte count mov al,[esi] ;V - get first byte from source it stops here -> mov [edi],al ;U - write second byte to destination mov al,[esi+1] ;V - get second byte from source mov [edi+1],al ;U - write second byte to destination mov al,[esi+2] ;V - get third byte from source it compiles it fine, but once it executes it I get the Unhandled exception at 0x1026edac (msvcr90d.dll) in Zoo.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd

    C / C++ / MFC help question

  • Problem with get/set method [modified]
    S Sivyo

    this doesn't help, I get Unhandled exception at 0x1026edac (msvcr90d.dll) in Zoo.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd

    C / C++ / MFC help question

  • Problem with get/set method [modified]
    S Sivyo

    I have been trying to figure out what is wrong with this code. its probably something really obvious just that isn't clear to me. I would like any help that can be given, thanks.

    int main(int argc,char* argv[])
    {
    Animals *ourAnimals[6];

    Animals *goldfish = new Goldfish();
    Animals *crocodile = new Crocodiles();
    Animals *elephant = new Elephants();
    Animals *gazelles = new Gazelles();
    Animals *shark = new Sharks();
    Animals *snakes = new Snakes();

    ourAnimals[0]=goldfish;
    ourAnimals[1]=crocodile;
    ourAnimals[2]=elephant;
    ourAnimals[3]=gazelles;
    ourAnimals[4]=shark;
    ourAnimals[5]=snakes;

    string name, gender, weight;

    name = "the Goldfish";
    gender = "Female";
    weight = "One Ounce";

    goldfish -> setName(name);
    goldfish -> setGender(gender);
    goldfish -> setWeight(weight);

    }

    and this is the class

    #pragma once
    #include <iostream>
    #include <string>

    using namespace std;
    class Animals
    {
    public:
    Animals(void);
    virtual ~Animals(void);

    string getName() {return m\_name;}
    string setName(string &name){return m\_name = name;}
    
    string getGender(){return m\_gender;}
    string setGender(string &gender){return m\_gender = gender;}
    
    string getWeight(){return m\_weight;}
    string setWeight(string &weight){return m\_weight = weight;}
    
    virtual void goOut() = 0;
    virtual void converse() = 0;
    virtual void getBack() = 0;
    

    protected:
    string m_name;
    string m_gender;
    string m_weight;

    };

    it gives me an unhandled exception error. this is my goldfish class

    #pragma once
    

    #include "marine.h"

    class Goldfish :
    public Marine
    {
    public:
    Goldfish(void);
    virtual ~Goldfish(void);

    virtual void converse();
    

    };

    Goldfish::Goldfish(void)
    {
    }

    Goldfish::~Goldfish(void)
    {
    }

    void Goldfish::converse()
    {
    cout<<"The Gold fish speak: "<<"Bloob Bloob"<<endl<<endl;
    }

    there is another derived class from Animal which is Called Marine in this case which looks like this

    #pragma once
    #include "animals.h"

    class Marine :
    public Animals
    {
    public:
    Marine(void);
    virtual ~Marine(void);

    virtual void goOut();
    virtual void converse()= 0;
    virtual void getBack();
    

    };

    #include "Marine.h"

    Marine::Marine(void)
    {
    }

    Marine::~Marine(void)
    {
    }

    void Marine::goOut()
    {
    cout<<"The Marine animals: "<<"swim out and are fed"<<endl<<endl;
    }

    void Marine::getBack

    C / C++ / MFC help question

  • Objects in Array loops, need help
    S Sivyo

    yea, I did that right after I posted this... I should of figured, the complier didn't reconize the method from ctrl space so I thought it didn't work... but it did... problem solved... Thanks for your ansswer, I am sure I will have more stupid questions soon

    C / C++ / MFC oop question data-structures help

  • Objects in Array loops, need help
    S Sivyo

    Alright, this is the thing... I have to create an Array for a number of objects in a setting with polymorphism. Each object in the array needs to do the same thing... so I figure I can just create a loop for each item in an array. Now, the method is called the same thing because of Polymorphism/inheritance Although the method is placed somewhere else for each object... so I have 10 classes. the Base class is called: Animals From Animals come: Marine, Reptiles, walkers From there we have 6 different types of animals deriving from those.

    #include "Gazelles.h"
    #include "Goldfish.h"
    #include "Sharks.h"
    #include "Snakes.h"

    #include <iostream>

    using namespace std;

    int main(int argc,char* argv[])
    {

    Animals *ourAnimals[6]; //the array

    Animals *goldfish = new Goldfish();
    Animals *crocodile = new Crocodiles();
    Animals *elephant = new Elephants();
    Animals *gazelles = new Gazelles();
    Animals *shark = new Sharks();
    Animals *snakes = new Snakes();

    ourAnimals[0]=goldfish;
    ourAnimals[1]=crocodile;
    ourAnimals[2]=elephant;
    ourAnimals[3]=gazelles;
    ourAnimals[4]=shark;
    ourAnimals[5]=snakes;

    for(i=0;i<6;i++)
    {
    ourAnimals[i] // ->to method I want it to go converse();
    }

    return 0;
    }

    each animal has converse, I am a bit of a noob with this obviously, so how do I get each object in the array to do what I want it to do?

    C / C++ / MFC oop question data-structures help

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    well, thanks to everyone for their help, I finished the assingment and now just hoping I did it well... got things done easier but don't think it was a very efficiant way. well, lets hope for the best

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    we learned C and C++ but I was never very good at it, and every time we learn a new language the problems become more difficult. Also, we only study each language up to 2 or 3 months, its a 2 year college.

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    I will do just that... Going to go to the school and see if I can work on it there and get some more help. Thanks everyone for trying to help me out, if anyone else can help out still that would be great, will pop in here often, C# is killing me

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    nah, don't have a problem with the strange 0, for some reason its not there anymore.

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    found another issue... I insert 3 6 fg and get an output of 4 7....

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    yea I figured that, there are two parts, the first part... Write a class that will be used for creating sets of whole numbers in the range of 0…100. Implement the sets with a Boolean array. Define in the class the following operations: 1. A constructor without parameters, which initialize the set as an empty set. 2. A constructor that gets an array of wholes and creates a set that contains those array members. 9. Override the methods ToString and Equals that inherit from Object in the following way: 10. ToString – will return a string representation of the set. Part two is where the user comes in Write a program that checks the sets class in the following way: • Create 2 sets by drawing 10 random numbers in the range of 0…100 for each set, and display the sets contents. • Perform intersection and union of the two sets and display the received sets. • Get from the user 3 numbers and create a third set. Check whether this set is a sub-set of one of the sets and display the result. I am also having problems that after I create union and intersection, there is only one set and not two and the originals die... I haven't played around with that yet so not going to ask for help with it yet.

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    boolSet should hold weather or no each array has been chosen. Example in an array of 5 and the numbers 1 2 3 5 were chosen then... 0 = False, 1 = False, 2 = true, 3 = True, 4 = False, 5 = True so the program will show on the Console Write line 1 2 3 5 SO I have random numbers from 0 to 100 chosen in order to create 2 separate sets. Then the user must insert 3 numbers to create a userSet. This is where I am having problems. If the user stays in range ect. then it works fine. But when he/she doesn't... well... I get out of bounds error. I know there must be an easier way of doing it... but I really don't have any experience

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    its crashing as soon as after the 3 numbers are entered. Maybe it would be better if one of the numbers is checked first then inserted into the array...

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    public set(int[] intSet)
    {
    this.boolSet = new bool[101];

            for (int i = 0; i < intSet.Length;i++)
    
                if (intSet\[i\] > 0 && intSet\[i\] < 100)
                {   
                   
                    boolSet\[intSet\[i\]\] = true;
                     
                }
                else
                {
                 
                   boolSet\[intSet\[i\]\] = false; 
                }
            }
        }
    

    would it be easier to check the range when user inserts numbers?

       int\[\] userIn = new int\[3\];
    
            bool flag = false;
            while (flag ==false)
            {
                Console.WriteLine("User, please enter 3 number 0 - 100");
                for (int i = 0; i < userIn.Length; i++)
                {
                    if (Int32.TryParse(Console.ReadLine(), out userIn\[i\])) 
                        flag = true;
    
                }
            }
    

    That is in main

    C# css data-structures help lounge

  • User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0
    S Sivyo

    I noticed when debugging that i is always equal to 0...

    C# css data-structures help lounge
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups