Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Trying to solve a probability problem in TC++ .... need help .. (http://www.go4expert.com/forums/trying-solve-probability-tcpp-help-t6461/)

 crazysunny21 20Sep2007 22:39

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

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 ....

 shabbir 21Sep2007 09:19

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

Quote:
 Originally Posted by crazysunny21 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 ....
You cannot have arrays but you have pointers for that.

Quote:
 Originally Posted by crazysunny21 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 ...
You can use the function strcat

Quote:
 Originally Posted by crazysunny21 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++ ...
Nope. You need to know the element length as it cannot be variable in C++

 shabbir 21Sep2007 14:04

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

Moved the thread to C-C++ forum.

 All times are GMT +5.5. The time now is 17:30.