User Profile

Collapse

Profile Sidebar

Collapse
hanna88
hanna88
Last Activity: Dec 22 '09, 01:19 PM
Joined: Oct 5 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • hanna88
    replied to where do they store??
    in C
    can you give me an example for this?
    let say the variable is declare in the main func wouldnt it be in stack instead?

    thank you for your reply...
    See more | Go to post

    Leave a comment:


  • hanna88
    replied to where do they store??
    in C
    if im right does it means...

    a) bss stores unitialized global variable and static member
    b) data stores the initialized global variable
    c) stack is the local variable without static and new/free/malloc//.... command
    d) heap is the one with new//malloc...etc command

    is that right? so what about text?

    Code:
    #include <string.h>
    
    char*str; [B]// bss[/B]
    int
    ...
    See more | Go to post

    Leave a comment:


  • hanna88
    replied to where do they store??
    in C
    thank you for your input :D
    See more | Go to post

    Leave a comment:


  • hanna88
    started a topic where do they store??
    in C

    where do they store??

    Code:
    tmain(intargc, _TCHAR* argv[]){
    int*p = new int;
    *p = 0;
    cout<< *p << endl;}
    where will p and *p will be stored? and in what other condition this can be changed to other part in memory like stack,heap,BSS, data,code??

    my ans for this would be p stored in heap due to the new command and *p will be stored in BSS since it is initialised to zero. but im not sure whether that is right....
    See more | Go to post

  • hanna88
    replied to how to store data in a different class object?
    in C
    i'll try to understand the code.u've been a great help! thank you . :D
    See more | Go to post

    Leave a comment:


  • hanna88
    replied to how to store data in a different class object?
    in C
    hi.this is the h.file for the code.

    Code:
    class Word {
    
    		private:
    			std::string word;
    
    		public:
    		Sentence *getSentence();
    		void setSentence(Sentence *sentence);
    		Word(string word); 
    		virtual string getKey() { return word;};
    		virtual ~Word();
    		virtual string asString();
    		__declspec( property(get = getSentence, put = setSentence))
    ...
    See more | Go to post

    Leave a comment:


  • hanna88
    replied to how to store data in a different class object?
    in C
    hi.thank you for your reply.



    just quick que.. is &vw is where i have the tokenize word in this case?
    i was given a constructor Word(string word); i reckon i cant just passed vector<word> into this constructor.so if i do it this way,will the data be passed to the Word object since i didnt declare it in a constructor?...
    See more | Go to post

    Leave a comment:


  • hanna88
    replied to how to store data in a different class object?
    in C
    but how should i indicate the word should be stored in class Word constructor.
    will this do .. Word* p where p is the tokenize word and keep updated in a while loop for strtok. thanks for your input.
    See more | Go to post

    Leave a comment:


  • hanna88
    started a topic how to store data in a different class object?
    in C

    how to store data in a different class object?

    hello..
    is there a way of storing data to other class object.
    here's the problem.
    class Repository is where it reads through the sentences and tokenize it
    into words . and what i did is by using strtok i keep all the tokenize words into a vector.and planning to store this vector of word into class Word object.

    im not sure whether this is a good idea because it seems hard to store a list of vector into an...
    See more | Go to post

  • hanna88
    replied to how to copy iostream& data into string?
    in C
    the string is been passed in iostream& form and the only for me to get access on the string is getline().im not sure whether it is right by using getline() first then convert it into string in order to tokenize it.

    any hint would be great! thanks again
    See more | Go to post

    Leave a comment:


  • hanna88
    replied to how to copy iostream& data into string?
    in C
    thanks for your reply.



    so how can i access the copied string into streamstream should i convert it back to string in order to use string method like strtok?...
    See more | Go to post

    Leave a comment:


  • hanna88
    started a topic how to copy iostream& data into string?
    in C

    how to copy iostream& data into string?

    hello,
    im having problem to copy the data from iostream& into string.and im not sure am i doing the right way by using getline.can anyone give hints how to solve this.

    here's to make things clear:


    Code:
    //method that reads through the stream and breaks it into words and sentence
    
    Document*Repository::addDoc(iostream& inStream,string docId)
    
    //test core
    ...
    See more | Go to post

  • que on Pointer to a class instance which is stored in a global variable

    here's the overview what ive done so far:
    Code:
    class A{};
    class B{};public A
    class C{}:public A
    
    //i need to create a function that keep track 
    //of num of active B and C instance
    //in other file.cpp and file.h 
    
    std::vector<A*> getsize();
    im not sure whether im on the right track by
    solving this using pointers to a class...
    See more | Go to post

  • hanna88
    started a topic return type for overload operator []
    in C

    return type for overload operator []

    hi there.i'm having problem to understand the test core.
    Code:
    // m1[ x ] is the matrix'row at xth position
    
    Vector v1=m1[x]
    
    //return
    v1 = [0 3 6]
    im pretty sure i need to return the reference of the matrix but how to write that since it is Vector type.

    any help would be great

    cheers
    See more | Go to post

  • hanna88
    replied to inheritance or friendship?
    in C
    thanks for the link! :)
    See more | Go to post

    Leave a comment:


  • hanna88
    started a topic best method to convert list of string to vector<int>?
    in C

    best method to convert list of string to vector<int>?

    what's the best way to convert a list of string to a vector<int>?
    what i have now is for loop and iterate each char in the string
    Code:
    string base="[0 3 ; 6 9 ; 12 15 ; 18 21]";
    
    
    //i have vector<int>row,vector < vector<int>row > mat;
    //what i want to do with the string is that everytime char != ";"
    
    row.pushback(str that convert to int)
    ...
    See more | Go to post

  • hanna88
    started a topic inheritance or friendship?
    in C

    inheritance or friendship?

    hello...
    i am looking for a better way of doing Class Matrix.

    the current code i have now is Class Vector which is inherited from Class Base.

    Class Matrix needs the vector in Class Vector and need some of its private member func like the number of column and protected member that is the vector itself.
    the common function between Class Vector and Class Matrix are tostring (convert int to str) and few overload...
    See more | Go to post

  • hanna88
    replied to combining two overloads operators
    in C
    i got an error of



    where did i do wrong?...
    See more | Go to post

    Leave a comment:


  • hanna88
    replied to combining two overloads operators
    in C
    thanks for your reply.

    im doing this using class.so should i make int x as a private member in order the function for operator[] to get the value x.
    See more | Go to post

    Leave a comment:


  • hanna88
    replied to combining two overloads operators
    in C
    overload operators problem

    here's the error i have in the test code:


    any hints to get the value that it is refering to?...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...