F&A Diskussionen
When 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 Stimmen
 4 AntwortenWhen 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 Stimmen
 2 AntwortenWher is mistake?
 0 Stimmen
 5 AntwortenHeute heiß
How create a new language ?
 1 Votes
Beginner question
 0 Votes
I need help to solve this
 0 Votes
Project
 0 Votes