Re: [algogeeks] do while problem

2011-07-29 Thread Ankur Khurana
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):"

Re: [algogeeks] do while problem

2011-07-29 Thread sunny agrawal
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() >

[algogeeks] do while problem

2011-07-29 Thread nullpointer
#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