已知C源程序如下:/ * longIntAdd * /include stdio. hinclude string. hdefine LENGTH 81void addLInt(char sl[],char s2[]); void reverse(char s[]) ; int main(){char intstrl[LENGTH],intstr2[LENGTH];printf("请输入超长整数的被加数和加数:\n")scanf("%s%s" ,intstrl ,intstr2) ; addLInt(intstrl ,intstr2) j printf("超长整数和为: %s" .intstrl); return 0;}void addLInt(char sl[] ,char s2[]) {int i=0,tmp,c=0;char s[LENGTH];if(strlen(s1)strlen(s2)){ strcpy(s,sl); strcpy(sl,s2); strcpy(s2,s);}reverse(sl);reverse(s2);while(s2[i]! ='\0'){tmp=sl[i]-'0'+s2[i]-'0'+ c;sl[i] = tmp%10+,0';c=tmp/10;i++; } while(sl[i]! ='\0,c){tmp=sl[i] —'0' + c;sl[i] = tmp%10+'0';c=tmp/10;i++; } If(c){sl[i++] = c+'0';sl[i] = '\0'; } reverse(sl);}void reverse(cliar s[]){inti,j,c;for(i=0,j = strlen(s) -l;ij;i++,j--){c=s[i]; s[i] = s[j]; s[j] = c; } }(1)画出程序中函数addLInt的控制流程图(10分);(2)设计一组测试用例,使该程序addLInt函数的语句覆盖率和分支覆盖率均能达到100%。如果认为该函数的语句覆盖率或分支覆盖率无法达到100%,需说明为什么(10分)。
已知C源程序如下:
/ * longIntAdd * /
include <stdio. h>
include <string. h>
define LENGTH 81
void addLInt(char sl[],char s2[]); void reverse(char s[]) ; int main()
{
char intstrl[LENGTH],intstr2[LENGTH];
printf("请输入超长整数的被加数和加数:\n")
scanf("%s%s" ,intstrl ,intstr2) ; addLInt(intstrl ,intstr2) j printf("超长整数和为: %s" .intstrl); return 0;
}
void addLInt(char sl[] ,char s2[]) {
int i=0,tmp,c=0;
char s[LENGTH];
if(strlen(s1)<strlen(s2)){ strcpy(s,sl); strcpy(sl,s2); strcpy(s2,s);
}
reverse(sl);reverse(s2);
while(s2[i]! ='\0'){
tmp=sl[i]-'0'+s2[i]-'0'+ c;
sl[i] = tmp%10+,0';
c=tmp/10;
i++; } while(sl[i]! ='\0,&&c){
tmp=sl[i] —'0' + c;
sl[i] = tmp%10+'0';
c=tmp/10;
i++; } If(c){
sl[i++] = c+'0';
sl[i] = '\0'; } reverse(sl);
}
void reverse(cliar s[])
{
inti,j,c;
for(i=0,j = strlen(s) -l;i<j;i++,j--){
c=s[i]; s[i] = s[j]; s[j] = c; } }
(1)画出程序中函数addLInt的控制流程图(10分);
(2)设计一组测试用例,使该程序addLInt函数的语句覆盖率和分支覆盖率均能达到100%。如果认为该函数的语句覆盖率或分支覆盖率无法达到100%,需说明为什么(10分)。