|
-
July 10th, 2009, 11:02 AM
#1
do-while loop
i have the following code with me :
#include<iostream.h>
#include<conio.h>
#define PI 3.14
void main()
{
char ch;
int radius;
do
{
cout<<"\nEnter the radius of the circle : "<<endl;
cin>>radius;
cout<<PI*radius*radius;
cout<<"\nDo you want to find area of another circle (y/n) : ";
cin>>ch;
}while(ch=='y');
}
after the code has run once.....and it asks :
Do you want to find area of another circle (y/n) : y5
as shown above if i enter y5...i get the area of my circle with radius y...can anyone plz explain this...why does any value given with "y" being accepted as the radius for new circle..
thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|