/* Programming Style 1: Choose the Right Condition
 *Improve the following program fragments through reorganization
 */

while(A) {
    if(B) continue;
    C;
}

do {
    if(!A) continue;
    else B;
    C;
   } while(A);

if(A)
    if(B)
        if(C) D;
        else;
    else;
else;
    if(B)
        if(C) E;
        else F;
    else;


while((c=getchar())!='\n') {
    if(c==' ') continue;
    if(c=='\t') continue;
    if(c<'0') return(OTHER);
    if(c<='9') return(DIGIT);
    if(c<'a') return(ALPHA);
    return (OTHER
/*Programming Style 2: Choose the Right Construct
 *Improve the following program fragments through reorganization
 */

done=1=0;
while (i<MAXI && !done) {
    if((x/=2)>1) {
        i++;
        continue; }
    done++;
}


{ 
    if(A) {B; return;}
    if(C) {D; return;}
    if(E) {F; return;}
    G; return;
}

plusflg=zeroflg=negflg=0;
if(a>0) ++plusflg;
if(a==0) ++zeroflg;
else if(!plusflg) ++negflg;
posted on 2012-08-09 13:07  abacuspix  阅读(185)  评论(0编辑  收藏  举报