那就要看你的功底进行人工纠错了。
打字不易,如满意燃银喊,望采纳。
请把代码中的if(i=j)break
修改为:
if(i>j)break
这样修改后的程序,运并空行后老橡会输出一个由*号组成的侍蔽旁直角三角形。
你的程序可以运行,没什么问题呀。
#include <stdio.h>void inputArray(int a[], int len) {
int index
for (index = 0 index < len ++index) {
scanf("%d", & a[index])
}
}
void sortArray(int a[], int len) {
int index
for (index = 0 index < len ++index) {
int max = index
for (int cursor = max + 1 cursor < len ++cursor) {
if (a[max] < a[cursor]) {
键前 max = cursor
}
}
if (max != index) {
int temp = a[index]
a[index] = a[max]
a[max] = temp
}
}
}
int checkArray(int a[], int len) {
int index, curror = a[0]
for (index = 1 index < len ++index) {
if (curror != a[index]) {
curror = a[index]
} else {
return 0
}
}
return 1
}
double average(int a[], int len) {
int sum = 0
int index
for (index = 0 index < len ++index) {
sum += a[index]
}
return 稿山清((double) sum / len)
}
int main() {
int a[20] = {
0
}
int len = sizeof(a) / sizeof(int)
inputArray(a, len)
sortArray(a, len)
if (checkArray(a, len)) {
double ave = average(a, len)
int index
for (index = 0 index < len ++index) {
if (a[index] < ave) {
printf("%d ", a[index])
}
}
} else {
printf("存在重复唯信数值!\n")
}
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)