User Profile

Collapse

Profile Sidebar

Collapse
mar11
mar11
Last Activity: Oct 13 '10, 03:59 PM
Joined: Sep 12 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • mar11
    started a topic operator overloading
    in C

    operator overloading

    Hi all,

    I want to implement an operator to be able to store strings in a queue implicitly through an operator. Something like that:

    Code:
    ...
    
    SetString( )
    
    {
    string1 >> string2 >> string3 >> string4 >> string5
    
    }

    The operator ">>" should then read each string and store it in a global queue by calling...
    See more | Go to post

  • mar11
    started a topic dereived class
    in C

    dereived class

    Hi,

    I want to derive a class from the main class as shown in the code below. But I am not sure how can I deal with the constructors of both classes.


    Code:
    // erasing from map
    #include <iostream>
    #include <string>
    #include <queue>
    #include <stdio.h>
    #include <sstream>
    using namespace std;
    
    
    class ma
    {
    ...
    See more | Go to post

  • mar11
    started a topic break a while statement
    in C

    break a while statement

    hallo all,

    how could I break the while statement inside the switch statement as follows:

    Code:
    enum st {s0, s1} state;
    while(true)
    {
    switch (state)
    
    case s0:
    // do something
    break;
    
    case s1:
    if(condition)
    //do something
    break;   //=======> here the while statement should be broken
    else
    //do something
    break;  //========> here the break
    ...
    See more | Go to post
    Last edited by Banfa; Jul 29 '10, 03:14 PM. Reason: Added [code]...[/code] tags

  • mar11
    replied to random generation of number
    in C
    I meant by each call I want to get through random as following:

    1 call: generated 2
    2 call: generated 8
    3 call: generated 600
    4 call: generated 212

    and so on.. and the range is between 0 and 1024..

    I hope the idea is clear now..
    See more | Go to post

    Leave a comment:


  • mar11
    replied to random generation of number
    in C
    I want to generate a number in the range between 0 and 1024. The sequence should be as the following: 0, 2, 4, 6,.. 1024. Each time I call the formula it should be generated one number like it is described above.
    See more | Go to post

    Leave a comment:


  • mar11
    started a topic random generation of number
    in C

    random generation of number

    Hi all,

    I want to generate a number between 0 and 1023 and the difference between two generated number is always 2, e.g. 1, 3, 5, ...., 1023.

    through modulo I can generate a number between 0 and 1023 but I can not find a formula to generate the desired number sequence..

    any suggestion...

    Best wishes,
    Mar
    See more | Go to post

  • mar11
    started a topic template function call
    in C

    template function call

    H all,

    I have seen an example in which the template function is called as the following:

    object_test.tem plate foo<argument>(f unxtion_argumen t);

    Could someone clarify me why template is added by function call at this way?

    Best regards
    See more | Go to post

  • mar11
    started a topic allocate memory on the heap
    in C

    allocate memory on the heap

    Hi all,

    I have problem by allocating a memory for my objects. Assuming this lines

    1- object* test;

    2- test = new object ;

    3- test->Attribute = true
    4- ....
    5- delete test;

    if i repeat this code several times then I get error by allocating the memory in line 2

    The error that i got is:
    test-project: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)...
    See more | Go to post

  • mar11
    started a topic memory leak
    in C

    memory leak

    Hi all,

    I am a bit confused about the real cause of memory leak in this case:

    int a(4);
    int Pointer_1*;
    int Pointer_2* = &a

    Pointer_1 = new int;

    Pointer_1 = Pointer_2;

    I know that the Pointer_1 is in this way overwritten and the pointer to the allocated int is lost. But i still can't understand why it leads to mem lack if the pointer to the allocated object...
    See more | Go to post

  • mar11
    replied to How to set if else within a flag for a makefile
    in C
    @donebock

    let us make the life more easy and tell me please how can i check which make Program do i use...
    See more | Go to post

    Leave a comment:


  • mar11
    replied to How to set if else within a flag for a makefile
    in C
    Sorry, I still do not understand you what do you actually want to know!!

    I think my question was clear enough as i described above. please can you read it again..

    any suggestions...
    See more | Go to post

    Leave a comment:


  • mar11
    replied to How to set if else within a flag for a makefile
    in C
    I have the version 3.81

    If there are more than one possibility to choose specific compiler-flag as i have described then i will appreciate to get some of suggestions.
    See more | Go to post

    Leave a comment:


  • mar11
    started a topic How to set if else within a flag for a makefile
    in C

    How to set if else within a flag for a makefile

    Do i have any possibility to set if/else within a flag which contains a coupile of libraries. COnsider this example:

    FLAG -L$(LIBRAY1_DIR) -L$(LIBRAY2_DIR) -llibrary1 - library2

    What i want do to do is for some compilation i want to include the second library - library2 and for other compilation i do not want to include it.

    I have done as the following(i am a beginner with Make). But it did not work at all....
    See more | Go to post

  • mar11
    replied to make vs shell
    in C
    is that mean that the makefile can contain any commands of any other scripting languages like shell and Perl??
    See more | Go to post

    Leave a comment:


  • mar11
    replied to make vs shell
    in C
    makefile

    dose the Make script have one commands or it can share the command of shell scripting too??

    thanks
    See more | Go to post

    Leave a comment:


  • mar11
    started a topic make vs shell
    in C

    make vs shell

    Hi,

    i hope i am here in the right place!!


    what is the difference between Make and shell?

    thanks
    See more | Go to post

  • mar11
    replied to object accessing
    in C
    @banfa;
    you may need this approach of accessing the object "Test" if you got the the function foo() from the file3.h as an interface function. In this case you are not allowed to change the name or declare it somewhere else....

    In this case how can you deal with it. i hope my question is getting through now. Again, i have to treat the foo() function in the file3.h as interface function.

    form you experience,...
    See more | Go to post

    Leave a comment:


  • mar11
    started a topic object accessing
    in C

    object accessing

    hi all,

    i have some trouble to figure out how can i access the object like in this case
    Code:
    //file1.h
    class T1{
    T1();
    ~T1();
    ....
    };
    ====
    //file2.h
    #include file1.h
    class T2{
    T2();
    ~T2();
    
    T1 Test;   // consider this object
    
    mem_foo() // member function
    ....
    };
    =====
    //file2.cpp
    ...
    T2::mem_foo(){
    ...
    See more | Go to post

  • mar11
    replied to instance project
    in C
    object instance

    your right!! the code are non-compilable. but that is still not my question.

    My question is how can i implement an global object correctly in "the same file structure" as it is written above??



    thanks
    See more | Go to post

    Leave a comment:


  • mar11
    replied to instance project
    in C
    you are right. i was in haste.. but that was not my real question!!

    do you have any suggestion?
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...