针对一下C语言程序,请按要求回答问题。 已知weekday. c源程序如下: include include 针对一下C语言程序,请按要求回答问题。已知weekday. c源程序如下:include<stidio. h>include<conio. h>/ *主函数* /Int main(){Char letter;Printf("please input the first letter,"Y'to exit!\n");While((letter=getch())!="Y")//当输入字母为Y时结束{Switch(letter){Case'S':Printf("%c\n",letter);Printf("please input second letter\n");//输入第二个字母If((letter=getch())=='a')Printf("Saturday\n");Else if(letter=='u')Printf("Sunday\n");Else printf('data error\n);Break;Case'F':Printf("fridaykn");Break;Case 'M':Printf("mondayha");Break;Case 'T':Printf("%c\n",letter);Printf("please input second letter\a");//输入第二个字母If((letter=getch())=='u')Printf("Tuesday\n"):Else if(letter=='h')Printf("Thursday\n");Break;Case 'W':Printf("Wednesday\n");}}Return 0;}(1) 画出主函数main的控制流程图;(2) 设计一组测试用例,使main函数的语句覆盖率尽量达到100%;(3) Main函数的语句覆盖率能否达到100%?如果认为无法达到,需说明原因。
针对一下C语言程序,请按要求回答问题。
已知weekday. c源程序如下:
include<stidio. h>
include<conio. h>
/ *主函数* /
Int main()
{
Char letter;
Printf("please input the first letter,"Y'to exit!\n");
While((letter=getch())!="Y")//当输入字母为Y时结束
{
Switch(letter)
{
Case'S':
Printf("%c\n",letter);
Printf("please input second letter\n");//输入第二个字母
If((letter=getch())=='a')
Printf("Saturday\n");
Else if(letter=='u')
Printf("Sunday\n");
Else printf('data error\n);
Break;
Case'F':
Printf("fridaykn");
Break;
Case 'M':
Printf("mondayha");
Break;
Case 'T':
Printf("%c\n",letter);
Printf("please input second letter\a");//输入第二个字母
If((letter=getch())=='u')
Printf("Tuesday\n"):
Else if(letter=='h')
Printf("Thursday\n");
Break;
Case 'W':
Printf("Wednesday\n");
}
}
Return 0;
}
(1) 画出主函数main的控制流程图;
(2) 设计一组测试用例,使main函数的语句覆盖率尽量达到100%;
(3) Main函数的语句覆盖率能否达到100%?如果认为无法达到,需说明原因。