This is novice programmer seeking help???

This is novice programmer seeking help???

#include
#include
unsigned int chec=0,lim=0;
char output[20];
FILE *fp;
int power(int a,int b)
{
int n,c=1;
for(n=0;n {
c*=a;
}
return c;
}
int check(unsigned int d,int a,int c)
{
fp=fopen(output,"a");
int y=0,x=0,n;
for(x=1;x<=c;x++)
{
for(y=2;y<=lim;y++)
{
n=power(x,y);
if(d==n)
{
fprintf(fp,"sum(%d:%d)=%d=%d**%d\\n",a,c,d,x,y);
}
}
}
}

int main()
{

unsigned int count=0,MAX,MIN;
scanf("%d%d%d",&MIN,&MAX,&lim);
unsigned int a[MAX],i,m=0,b[MAX],k=0,j=0,c,f;
for(i=1;i<=2;i++)
gets(output);

for(i=MIN;i<=MAX;i++)
{
a[m]=i;
m++;
}
j=m;
for(m=0;m<=j-1;m++)
{
if(a[m]>0)
{
for(i=2;i<=a[m]-1;i++)
if(a[m]%i==0)
break;
if(i==a[m])
{
b[k]=a[m];
k++;
}
else
continue;
}
else
continue;
}
b[k++]='\\0';
for(k=0;b[k]!='\\0';k++)
{
b[k];
}
/*printf("\\nThe Number of Prime numbers in the given range are.......%d",k);*/
fp=fopen(output,"w");
for(i=0;i<=k;i++)
{
c=b[i];
for(j=i+1;j {
c+=b[j];
m=check(c,b[i],b[j]);

}
}
getch();
}

Sir this is what the program i wrote and am in a need of ur help that how to give command line arguments and how to use them....i'm just a school student....so please consider this and reply me as soon as possible.
And please give some remarks on the program that is shown above.

2 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Hello,

To use command line arguments, you'll need to use the version of main() that takes two arguments. You can find an explanation at http://publications.gbdirect.co.uk/c_book/chapter10/arguments_to_main.html

I hope that helps.

Best regards,

==
Aubrey W.
Intel Software Network Support

Connectez-vous pour laisser un commentaire.