so here is my code -- whenever i try to compile it says SYNTAX error
#include <stdio.h>
long FindMaximum(long* numbers, int count)
{
long max = numbers[0];
int i;
for(i = 0; i< count; i++)
{
if (numbers[i] > max)
{
max = numbers[i];
}
}
return max;
}
long FindMinimum(long* numbers, int count)
{
long min = numbers[0];
int i;
for(i = 0; i< count; i++)
{
if (numbers[i] < min)
{
min = numbers[i];
}
}
return min;
}
float FindAverage(long* numbers, int count)
{
long sum = 0;
int i;
for(i = 0; i< count; i++)
{
sum += numbers[i];
}
if (sum == 0)
return 0;
return sum/(float)count;
}
void ParseFile(char* fileName)
{
printf("This Program will print the list of numbers in the data, and it’s Max, Min and Avg Values.\n");
char line[80];
long number[100];
int i;
for(i = 0; i<100;i++)
{
number[i] = 0;
}
FILE* fr = fopen (fileName, "r"); /* open the file for reading */
int index = 0;
while(fgets(line, 80, fr) != NULL)
{
sscanf (line, "%ld", &number[index++]);
printf ("%ld\n", number[index-1]);
}
printf("The minimum is %ld \n",FindMinimum(number,index));
printf("The maximum is %ld \n",FindMaximum(number,index));
printf("The average is %4.2f \n",FindAverage(number,index));
fclose(fr);
}
int _tmain(int argc, _TCHAR* argv[])
{
ParseFile("c:\\justin\\data.txt");
return 0;
}
here is error:
Compiler: Default compiler
Executing gcc.exe...
gcc.exe "C:\cygwin\home\Justin\Individual_Project.c" -o "C:\cygwin\home\Justin\Individual_Project.exe" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\cygwin\home\Justin\Individual_Project.c:68: error: syntax error before "_TCHAR"
Execution terminated
Can someone tell me what exactly is off?