Better Students Ask More Questions.
Please,give one or two programmes using do...while loop in c++?
2 Answers | add yours
A do while loop in C++ is a block of code that executes so long as the condition of the do while are being met. Once they cease to be met, the program exits the loop. For instance (in plain English):
do count while count is less than twenty
In C++ this would look like:
} while (count<20);
Posted by crmhaske on October 10, 2010 at 12:11 AM (Answer #1)
Here is a program on interest calculation using do while loop
float cal (float amt, int year, float rate=15);
void prn (char c='*');
void main ()
float amount, interest;
cout<<"Enter the amount on which interest has to be calculated: -";
cout<<"Enter the number of years: -";
interest=cal (amount, year);
cout<<"The interest on-"<<amount<<"-for the period of-"<<year<<" years would be"<<interest<<endl;
float cal (float amt, int year, float rate)
sum=sum * (1+ (rate/100));
void prn (char c)
for (int i=0; i<40; i++)
Posted by satavisha on February 10, 2011 at 8:01 PM (Answer #2)
Join to answer this question
Join a community of thousands of dedicated teachers and students.