'How exactly would the control flow graph look like for this code?
I'm trying to draw a control flow graph for this small piece of code so I can run a CC on it. I can't seem to grasp how to end the graph. Will there be another edge that goes from the while back to the top or the while to an exit node? If I draw an exit node and draw an edge to it, I get a CC of 2, but the analysis tool gives me a CC of 3. I made a graph but I can't post because I don't have enough rep.
public static void readCustomerData()
{
int customerCount = 0;
String customerNumber, cLastName, cFirstName;
double customerBalance;
while(masterFile.hasNext() && customerCount < MAX)
{
statement1;
statement2;
statement3;
statement4;
statement5;
statement6;
statement7;
increment statement++;
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
