void display()
{
printf("every thing is ok");
}
void main()
{
int ch;
while(1)
{
printf("enter your choice");
scanf("%d",&ch);
switch(ch)
{
case 1: clrscr();printf("when choice is one every thing is fine");
display();
break;
case 2: clrscr();printf("when chice is two its confusing");
display();
break;
case 3: exit(0);
default: printf("enter choice as 1 or 2 or to exit enter 3");
}
}
}
이 C 프로그램을 추적하고 선택 사항을 2로 입력하면 case 1 블록의 표시 기능이 호출됩니다. 난 그것을 이해하지 못 했어. 설명과 함께 회신 해주십시오. 나는 정말로 혼란 스럽다.c switch 문
나에게 잘 보입니다. 1을 입력하면 어떻게됩니까? "case 1 블록에서 displau 함수를 호출"한다는 것은 무엇을 의미합니까? 제공된 코드에서 case 1과 case 2 모두에서 Display()가 호출됩니다. –
예상되는 출력은 무엇이며보고있는 내용은 무엇입니까? – casablanca
* 정확한 * 출력을 보여주십시오. 나는 그것이 재미있는 것을 밝힐 것이라고 믿는다. – abelenky