#include <iostream>
#include <cmath>
using namespace std;
typedef string ActType[50];
int main () {
ActType act;
int numOfact;
int ET;
cout<<"Enter the number of activity to be read: ";
cin>>numOfact;
for (int a = 0; a < numOfact; a++){
cout<<"Enter Activity: ";
cin>>a[act];
}
for (int ip = 0; ip < numOfact; ip++){
cout<<"Enter IP of "<<act[ip]<<": ";
cin>>ip[act];
}
for (int ot = 0; ot < numOfact; ot++){
cout<<"Enter OT: ";
cin>>ot;
ET = (ot + 4 * mt + pt) / 6; // <------------ here is the only error :|
cout<<ET;
return 0;
}
This is the table I was referring to because this is a PERT.cpp program actually
ACTIVITY IP OT MT PT ET ES EF LS LF Slack
A none 2 3 4 3 0 3 0 3 0
B
C
D
E
F
G
H
I
J
K
L
M
the code is the one I was doing and the output on the compiler must be this..
Enter the number of activity to be read: 13
Enter Activity: A
|
|
|
|
|
|
|
|
|
Enter Activity: M <--- 13th time
Enter IP of A: none
|
|
|
|
|
|
|
|
Enter IP of M: l <--- 13th time
Enter OT: 2
|
|
|
|
|
|
|
|
|
Enter OT: 2 <--- 13th time
Enter MT: 3
|
|
|
|
|
|
|
Enter MT: 2 <--- 13th time
Enter PT: 4
|
|
|
Enter PT: 2 <--- 13th time
ET of A is 3
ET of B is 12
|
|
|
|
|
ET of M is 2 <--- 13th time
to come up of that answer in the 1st column ET = (OT + 4 * MT + PT) / 6, just ignore the rest.
I really don't get this :|
It seems to me that you have a bunch of scope issues, that is to say you are trying to access data that is declared inside of the for loop from the outside. This is not cool anymore, C++ does not support it. Take all of those int declarations in all of those for loops and declare them one level up, this should fix most of your issues.
Please take a look at the code brackets for future use.