Click here to Skip to main content
16,005,467 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: FTPclient code (send,get,delete files) Pin
Hamid_RT14-May-06 19:38
Hamid_RT14-May-06 19:38 
AnswerRe: FTPclient code (send,get,delete files) Pin
ThatsAlok14-May-06 22:25
ThatsAlok14-May-06 22:25 
Questionclasses VS structs Pin
big_denny_20014-May-06 5:26
big_denny_20014-May-06 5:26 
AnswerRe: classes VS structs Pin
Hamid_RT14-May-06 5:36
Hamid_RT14-May-06 5:36 
GeneralRe: classes VS structs Pin
big_denny_20014-May-06 6:13
big_denny_20014-May-06 6:13 
AnswerRe: classes VS structs Pin
Ryan Binns14-May-06 19:06
Ryan Binns14-May-06 19:06 
AnswerRe: classes VS structs Pin
ThatsAlok14-May-06 22:19
ThatsAlok14-May-06 22:19 
QuestionTemplates help Pin
Tara1414-May-06 4:37
Tara1414-May-06 4:37 
Hi,

I am struggling with templates, derived classes and virtual function.
Some help would be highly appriciated.

I have one template class 'RV' and another class 'NormalDistribution' derived from 'RV'

how do I use the NormalDistribution class in the main()??
Cry | :((
/////////////////////////////////// template class 'RV' ///////////////
template <typename t="">
class RV { // abstract base template class holding random variables
protected:
T min, max, n;
public:
RV();
void setMinMaxCount(T a, T b, T n)
{ min = a; max = b); }
virtual T generate() = 0;
virtual T pdf(T val) = 0; // virtual functions
virtual T cdf() = 0;

};

template <typename t=""> class NormalDistribution : public RV<t> {
double randNum1,randNum2;
public:
NormalDistribution();
double generate()
{ // some calculations
randNum1 = ra = (((double)rand () / RAND_MAX) * 1);
randNum2 = min + (max-min)*randNum1/n;
rand3=(-log(rand2))/1;
return rand3;
}
double cdf(double val)
{ return (1-exp(-1*val)); }
};


int main()
{
// call 'NormalDistribution' class and assign values to max,min,n and then call generate function
}

////////////////////////////////////////////////

How do I do it?

Thanks,
Tara


Fortitudine Vinsinues!
QuestionDouble Pin
cuongcntt200214-May-06 4:33
cuongcntt200214-May-06 4:33 
AnswerRe: Double Pin
Chris Losinger14-May-06 4:52
professionalChris Losinger14-May-06 4:52 
AnswerRe: Double Pin
Hamid_RT14-May-06 5:05
Hamid_RT14-May-06 5:05 
AnswerRe: Double Pin
ThatsAlok14-May-06 20:49
ThatsAlok14-May-06 20:49 
QuestionTab order - CDialog within CWnd Pin
YaronNir14-May-06 4:16
YaronNir14-May-06 4:16 
AnswerRe: Tab order - CDialog within CWnd Pin
Nishad S14-May-06 18:10
Nishad S14-May-06 18:10 
GeneralRe: Tab order - CDialog within CWnd Pin
YaronNir14-May-06 20:33
YaronNir14-May-06 20:33 
QuestionCharacter Pin
cuongcntt200214-May-06 4:12
cuongcntt200214-May-06 4:12 
AnswerRe: Character Pin
Hamid_RT14-May-06 4:21
Hamid_RT14-May-06 4:21 
GeneralRe: Character Pin
cuongcntt200214-May-06 4:24
cuongcntt200214-May-06 4:24 
QuestionSimilar DC method RoundRect in GDI+ Pin
YaronNir14-May-06 2:25
YaronNir14-May-06 2:25 
QuestionLinkage MFC problems Pin
Dave_Roach14-May-06 2:15
Dave_Roach14-May-06 2:15 
AnswerRe: Linkage MFC problems Pin
Hamid_RT14-May-06 4:25
Hamid_RT14-May-06 4:25 
GeneralRe: Linkage MFC problems Pin
Dave_Roach14-May-06 4:49
Dave_Roach14-May-06 4:49 
AnswerRe: Linkage MFC problems Pin
Saurabh.Garg14-May-06 15:10
Saurabh.Garg14-May-06 15:10 
Questionusing different bitmaps dynamicallt on custom slider Pin
snir_ya14-May-06 2:05
snir_ya14-May-06 2:05 
Questionfractional random numbers Pin
Tara1414-May-06 1:17
Tara1414-May-06 1:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.