Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exercise Computing the cyclomatic complexity Philippe CHARMAN Last update: 05-15-2014.

Similar presentations


Presentation on theme: "Exercise Computing the cyclomatic complexity Philippe CHARMAN Last update: 05-15-2014."— Presentation transcript:

1 Exercise Computing the cyclomatic complexity Philippe CHARMAN charman@fr.ibm.com http://users.polytech.unice.fr/~charman/ Last update: 05-15-2014

2 Exercise Draw the control flow graph of the following function What is the value of its cyclomatic complexity Use another method to compute it and check the value is the same

3 void Library::RemoveSubscriber(int code_sub) { Position pos = SubList.getHeadPostition(); while (pos) { if (code_sub == SubList.getAt(pos).getCode()) { if (SubList.getAt(pos).getExpirationDate() == 0) { if (SubList.getAt(pos).getBooks() == 0) { SubList.getAt(pos).removeSubscriber(); cout << “The subscriber has been removed” << endl; return; } else { cout << “Books must be returned first” << endl; return; } else { cout << “The subscriber is already removed” << endl; return; } else { SubList.getNext(pos); } cout << “This subscriber doesn’t exist” << endl; }


Download ppt "Exercise Computing the cyclomatic complexity Philippe CHARMAN Last update: 05-15-2014."

Similar presentations


Ads by Google