or cin.ignore() or while(getchar()!='\n'0; instead of only a getchar.
On Fri, Jul 29, 2011 at 5:03 PM, sunny agrawal wrote:
> when you enter two numbers and press Enter
> new line character is passed as character c
>
> Change your code as Follows:
>
>
> printf("do you want to continue(y/n):"
when you enter two numbers and press Enter
new line character is passed as character c
Change your code as Follows:
printf("do you want to continue(y/n):");
getchar();
scanf("%c",&c);
On Fri, Jul 29, 2011 at 4:31 PM, nullpointer wrote:
> #include
> void add();
> void subtract();
> int main()
>
#include
void add();
void subtract();
int main()
{int choice;
printf("enter your choice:1.add 2.subtract:");
scanf("%d",&choice);
switch(choice)
{case 1:
add();
break;
default:
printf("wrong choice entered");
}
}
void add()
{int a,b;
char c;
do
{printf("enter two numbers:");
sc