标签 > C语言程序改错题及答案[编号:28046466]
C语言程序改错题及答案
先将在字符串s中的字符按逆序存放到t串中。先将在字符串s中的字符按逆序存放到t串中。然后把s中的字符按正序连接到t串的后面。然后把s中的字符按正序连接到t串的后面。当s中的字符串为。则t中的字符串应为。则t中的字符串应为。根据整型形参m的值。
C语言程序改错题及答案Tag内容描述:<p>1、程序调试 1、 #include stdio.h #include string.h void fun(char *s,char *t) int i,sl; sl=strlen(s); for(i=0;isl;i+) ti=si; for(i=0;isl;i+) /*1*/ / tsl+i=ss1-1-i; t。</p><p>2、第1题】给定程序MODI1.C中函数fun的功能是:将长整数中每一位上为偶数的数依次取出,构成一个新数放在t中。高位仍在高位,低位仍在低位。例如,当s中的数为87654时,t中的数为:864.#include conio.h#include stdio.hVoid fun (long s, long *t)int d ; long s。</p><p>3、第1题】给定程序MODI1.C中函数fun的功能是:将长整数中每一位上为偶数的数依次取出,构成一个新数放在t中。高位仍在高位,低位仍在低位。例如,当s中的数为87654时,t中的数为:864.#include #include Void fun (long s, long *t)int d ; long sL=1*t=0While (s0)d=s%10/*FOUND*/if (d%2=0) 答案 if(d%2= =0)/*FOUND*/*t=d*sl+t; 答案 *t=d*sl+*t;sl*=10/*FOUND*/s=10; 答案 s/=10 ;main()long s, t;clrscr();prin。</p><p>4、第1题】给定程序MODI1.C中函数fun的功能是:将长整数中每一位上为偶数的数依次取出,构成一个新数放在t中。高位仍在高位,低位仍在低位。例如,当s中的数为87654时,t中的数为:864.#include #include Void fun (long s, long *t)int d ; long sL=1*t=0While (s0)d=s%10/*FOUND*/if (d%2=0) 答案 if(d%2= =0)/*FOUND*/*t=d*sl+t; 答案 *t=d*sl+*t;sl*=10/*FOUND*/s=10; 答案 s/=10 ;main()long s, t;clrscr();printf。</p><p>5、程序改错 功能 根据整型形参m的值 计算如下公式的值 1 1 1 t 1 2x2 3x3 mxm 例如 若m 5 则应输出 0 536389 include stdio h double fun int m double y 1 0 int i FOUND for i 2 im i for i 2 i m i FOUND y 1 i i。</p><p>6、程序改错 1题目 在一个一维整型数组中找出其中最大的数及其下标 程序中共有4条错误语句 请改正错误 define N 10 FOUND float fun int a int b int n int c max a for c a 1 ca n c if cmax max c FOUND b c a return max main int a N i max p 0 printf please。</p>