各位老师,把txt中数字写入数组a,然后从a数组中提取size_b个连续的波峰波谷值放...
各位老师,把txt中数字写入数组a,然后从a数组中提取size_b个连续的波峰波谷值放入b数组中,写入a数组成功,提取size_b个连续的波峰波谷值放入b数组中失败,请老师看看问题出在哪里?谢谢了。#include "stdafx.h"
#include <iostream>
int readfile2D()
{
int a;
int i;
FILE* fp = fopen("C:\\Users\\Administrator\\Desktop\\Table.txt", "r");
if (fp == NULL)
{
printf("文件无效");
return -1;
}
for (i = 0; i<20; i++)
fscanf(fp, "%d", &a);
fclose(fp);
for (i = 0; i<20; i++)
printf("%d ", a);
printf("\n");
return 0;
}
int _tmain(int argc, char *argv[])
{
readfile2D();
getchar();
//return 0;
}
//int a;
int b;
int maxmin(int a[], int b[], int size_a, int size_b)
{
int i = 0, j = 0;
for (i = 0; i < size_a - 1;)
{
while (a < a)
{
i++;
}
b = a;
if (j >= size_b)
return j;
while (a > a)
{
i++;
}
b = a;
if (j >= size_b)
return j;
}
}
int main1(int a[], int b[], int argc, char **argv)
{
int i = 0, j = 0;
j = maxmin( a, b, 20, 8);
for (i = 0; i < 8; i++)//
{
printf("b[%d] = %d\n", i, b);
}
printf("\n");
getchar();
return 0;
} 哪位各位老师指导一下,谢谢了
页:
[1]