题目内容

阅读程序,写出运行结果#include void Func(int x) {x = 20;}int main() {int x = 10;Func(x);printf("%d", x);return 0;}

查看答案
更多问题

阅读程序,写出运行结果#include void Func(int b[]) {int j;for (j = 0; j < 4; j++)b[j] = j;}int main() {static int a[] = {5, 6, 7, 8}, i;Func(a);for (i = 0; i < 4; i++)printf("%d", a[i]);return 0;}

阅读程序,按要求在空白处填写适当的表达式语句,使程序完整并符合题目要求。下面程序模拟了骰子的6000次投掷,用函数rand()产生1~6之间的随机数face,然后统计每一面1~6出现的机会(概率)存放到数组frequency中。#include #include #include int main() {int face, roll, frequency[7] = {0};srand(time(NULL));for (roll = 1; roll <= 60000; roll++) {face = ____①____;++____②____;}printf("%4s%17s\n", "Face", "Frequency");for (face = 1; face <= 6; face++)printf("%4d%17d\n", face, frequency[face]);return 0;}

阅读程序,按要求在空白处填写适当的表达式语句,使程序完整并符合题目要求。下面程序从键盘输入一行字符并统计其中有多少单词。假设单词之间以空格分开。#include int main() {char str[200];int i, num;gets(str);num = str[0] != ' ' ? 1 : 0;for (i = 1; str[i] ____①____; i++) {// 若当前字符不是空格,而前一字符是空格,则表示有新单词出现if (str[i] ____②____ && str[i - 1] ____③____)num++;}printf("num=%d\n", num);return 0;}

阅读程序,按要求在空白处填写适当的表达式语句,使程序完整并符合题目要求。下面函数的功能是删除字符串s中所出现的与变量c相同的字符。void Squeeze(char s[], char c) {int i, j;for (i = j = 0; ____①____; i++) {if (s[i] != c) {____②____;j++;}}s[j] = '\0';}

答案查题题库