Rewrite the following piece of code using only if() and while() statements:
case'a': p = one(q);
break;
case'b': p = p %2;
case'c': do {
r += p*q;
p *=2;
} while (p < 20);
break;
case 'd':
case 'e': for(i=0;i<4;i++) {
p += q+r;
q = q/2;
r = r%2;
}
break;
default: cout << "Try again!\n";
}
Ayency
0
Newbie Poster
Recommended Answers
Jump to PostAnd you need it in C++(?) or in PHP? What have you done so far?
All 4 Replies
cereal
1,524
Nearly a Senior Poster
Featured Poster
diafol
cereal
1,524
Nearly a Senior Poster
Featured Poster
diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.