I know this is a stupid questions

how do i send this :

struct Activity {
    int i,               // Beginning node number.
        j;               // Ending node number.
    float  pt,           // Pessimistic time. 
           prt,          // Most probable time.
           ot;           // Optimistic time.
    char desc[21];       // Activity description.
  } p[51];

into this:

using namespace std;

float* expect_t(float expt[], *p, int n)
 {
  for( int i = 1; i <= n; ++i ) {
    expt[i] = ( p[i].pt + ( 4.0f * p[i].prt ) + p[i].ot ) / 6.0f;

  }
  return expt;
 }

Any help would be appreciated.

Recommended Answers

All 2 Replies

using namespace std;

float* expect_t(float expt[], *p, int n, Activity & myActivityStruct)
 {
  for( int i = 1; i <= n; ++i ) {
    expt[i] = ( p[i].pt + ( 4.0f * p[i].prt ) + p[i].ot ) / 6.0f;

  }
  myActivityStruct.someAttribute = someValue;  
//deleted your attributes and forgot what they were, just sub someAttribute 
//with something from the struct
  return expt;
 }

thanks for the quick response :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.