正在加载图片...
第一部分c语言程序设计上机指导 #include <stdio. h> int a b scanf(“a,各d”,p,q) printf("器d,器dn”,a,b) p 运行结果 错误 错误所在 应改为: 2. #include <stdio. h> i int *p,*q i int a b scanf(“d,告d”,*p,*q) (”d,暑a\n", printf(“暑d,d\n”,*p,*p) 正确 运行结果 错误 3.以下程序实现求数组中的元素的和。 #include <stdio. h>第一部分 C 语言程序设计上机指导 ·73· ·73· 1. #include <stdio.h> main() { int *p ,*q ; int a , b ; printf(“Input a ,b”); scanf(“%d,%d”, p ,q); printf(“%d,%d\n”,a ,b); printf(“%d,%d\n”,*p ,*b); } 正确 运行结果: 错误 错误所在: 应改为: 2. #include <stdio.h> main() { int *p ,*q ; int a , b ; p = &a; q =&b scanf(“%d,%d”, *p ,*q); printf(“%d,%d\n”,a ,b); printf(“%d,%d\n”,*p ,*p); } 正确 运行结果: 错误 错误所在: 应改为: 3. 以下程序实现求数组中的元素的和。 #include <stdio.h> main() { int a[10]={1,2,3,4,5,6,7,8,9,0}; int sum ,*p ; sum=0; p=&a; while( p < p+10) s + = *p; printf(“sum=%d\n”,sum); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有