SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 121 | Next

J. C. Huang

"Path-Oriented Program Analysis"

The first two are due
to Theorem 6.7 and the last is due to Corollary 6.6.
136
Appendix A
?‡” cin >> x;
y = 1;
/ \ x <= 100;
while (x <= 100) {
x = x + 11;
y = y + 1;
}/
\ x > 100;
/ \ x <= 111;
/ \ y != 1;
while (y != 1)
?†’ / \ x > 100;
?†’ / \ x <= 111;
?†’ / \ y != 1;
?†’ {{{
?†’ / \ x > 99
?†’ / \ x <= 110;
?†’ x = x + 1;
?†’ ,,,
?†’ / \ x > 110;
?†’ x = x ??“ 10;
?†’ y = y ??“ 1;
?†’ }}}
z = x ??“ 10;
cout << ???z = ??? << z << endl;
?‡” cin >> x;
y = 1;
/ \ x <= 100;
while (x <= 100) {
x = x + 11;
y = y + 1;
}/
\ x > 100;
/ \ x <= 111;
/ \ y != 1;
while (y != 1)
{{{
/ \ x > 100;
/ \ x <= 111;
/ \ y != 1;
/ \ x > 99
/ \ x <= 110;
x = x + 1;
,,,
/ \ x > 100;
/ \ x <= 111;
/ \ y != 1;
/ \ x > 110;
x = x ??“ 10;
y = y ??“ 1;
}}}
z = x ??“ 10;
cout << ???z = ??? << z << endl;
This is done by virtue of Corollary 4.9.
137
Appendix A
?‡” cin >> x;
y = 1;
/ \ x <= 100;
while (x <= 100) {
x = x + 11;
y = y + 1;
}/
\ x > 100;
/ \ x <= 111;
/ \ y != 1;
while (y != 1)
{{{
?†’ / \ x > 100;
?†’ / \ x <= 111;
?†’ / \ y != 1;
?†’ / \ x > 99
?†’ / \ x <= 110;
?†’ x = x + 1;
?†’ ,,,
?†’ / \ x > 100;
?†’ / \ x <= 111;
?†’ / \ y != 1;
?†’ / \ x > 110;
?†’ x = x ??“ 10;
?†’ y = y ??“ 1;
}}}
z = x ??“ 10;
cout << ???z = ??? << z << endl;
?‡” cin >> x;
y = 1;
/ \ x <= 100;
while (x <= 100) {
x = x + 11;
y = y + 1;
}
while (y != 1)
{{{
/ \ x > 100;
/ \ x <= 110;
/ \ y != 1;
x = x + 1;
,,,
/ \ x == 111;
/ \ y != 1;
x = x ??“ 10;
y = y ??“ 1;
}}}
z = x ??“ 10;
cout << ???z = ??? << z << endl;
This is obtained through logical simplification of the loop body.


Pages:
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133