in codeeval, some challenges ask us to test cases are read in from a file which is the first argument to your program, what is that mean, the first argument to your program?
my code can work in my pc, but when I submit the solution, it show I am wrong, I don't know how to change the path to the first argument.
my code as follows:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
int num[100];
int i;
int sum = 0;
char ch;
int reminder;
fp = fopen("one.txt", "r+");
do{
fscanf(fp, "%d", &num[i]);
while(num[i]!=0){
reminder = num[i]%10;
sum = sum + reminder;
num[i] = num[i]/10;
}
printf("%d\n", sum);
sum = 0;
i++;
}while((ch = fgetc(fp)) != EOF);
fclose(fp);
system("pause");
return 0;
}