New course! Every coder should learn Generative AI!
Try a free lessonQ&A Discussions
goto statement problem!
2 Votes
4 AnswersWhen I enter two numbers the sum is displayed.. but when I input character as yes not y... Then it goes into an infinite loop... can anyone explain why?
int a,b;
char ch;
do
{
cout<<"Enter two numbers: ";
cin>>a>>b;
cout<<"The sum is "<<a+b
<<"\nDo you want to try again (y/n): ";
cin>>ch;
}while(ch=='Y'||ch=='y');
0 Votes
4 AnswersWhen I enter two numbers the sum comes.. but when I input character as yes not y... Then it goes into an infinite loop... can anyone explain why?
int a,b;
char ch;
do
{
cout<<"Enter two numbers: ";
cin>>a>>b;
cout<<"The sum is "<<a+b
<<"\nDo you want to try again (y/n): ";
cin>>ch;
}while(ch=='Y'||ch=='y');
0 Votes
2 AnswersHot today
Why is this wrong
1 Votes
What is wrong with this?
0 Votes
Help me please)
1 Votes
I feel lost
0 Votes
Android development course
0 Votes
Question
1 Votes
Did Sololearn basically delete the ability to insert a code or post as a comment in lessons?
0 Votes
audio and video url
0 Votes