I am a beginner
I have to write a code in straight "C"
the code has to read from a file from c:\temp
c:\temp\numbers.txt
inside that txt file are the numbers
2 4 6 8 -3 20 30 40 60 80 100 200
It reads the txt in my code perfect
It is supposed to multipy by 6 each number
that is a
positive
and less than 100
and show the output
I get a calculation and output of all numbers found
I cannot get my if statement correct to check the criteria
if (i > 0 || i < 100);
I also tried
if (i > 0, i < 100);
also of criteria is not met:
print an error message to console stating the problem
Bad part is we have to use Miracle C to compile and build
I am sure this is simple to all of you. But I am needing assistance with my
if statement at least,....error message would be great also too
Thank you in advance for at least reading this
#include <stdio.h>;
int IntegerArray[25];
int i;
void main()
{
FILE*f; // informing to use a file
f=fopen("c:\\temp\\numbers.txt","r"); //the file to open with the data
while (fscanf(f,"%d",&i)!=EOF) //scanning the file and data to include numbers
{
if (i > 0 || i < 100); //<<<------supposed to ensure # is positive, less than 100 I ...
// ........cant figure out if input fails criteria...
//to print error message to console stating the problem with the bad numbers
printf(" %d\n",i*6); //if i = criteria times them by 6 and show output to console
}
fclose(f);
getch();
}