1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Trying to solve a probability problem in TC++ .... need help ..

Discussion in 'C++' started by crazysunny21, Sep 20, 2007.

  1. crazysunny21

    crazysunny21 New Member

    hi ..

    my name is Sunny... i am a beginner in C++ lang...

    i m trying to write a program to check the probability of tossing a coin 2,3,4 times or n number of times ....

    now as i said it is tossing of coin .. so there are just 2 possibilities ... either H or T ...

    i wanna have a sample space set ... for tht i have thought something but i dont know whether it is possible or not ...

    i wanna know :

    1. usually we define array with some size .. eg int a[5] which can store 5 elements ... i wanna know is it possible to declare an array whose size is not fixed ....

    2. if i m having 2 arrays of char type ... can i concatinate i th and j th element of these arrays and store the result in 3rd array ... and if yes how .... please if u can tell me the syntax ...

    3. like in java we can count the length of the array by using
    lenght.arrayname ... can we also count the length of array in C++ ...

    these are some of the basic questions as of now in my mind ... if some one can plzzzz help me out ...

    Sunny ....
     
  2. shabbir

    shabbir Administrator Staff Member

    You cannot have arrays but you have pointers for that.

    You can use the function strcat

    Nope. You need to know the element length as it cannot be variable in C++
     
  3. shabbir

    shabbir Administrator Staff Member

    Moved the thread to C-C++ forum.
     

Share This Page