main() { clrscr(); puts(" This program is to find the real root of"); puts(" function cos(x)-x=0."); printf(" >> The real root is %f.\n",countvalue()); printf(" >> The result of cos(%f)-%f is %f.\n",countvalue(),countvalue(),cos(countvalue())-countvalue()); writeDat(); PressKeyToQuit(); }
writeDat() { FILE *wf; wf=fopen("OUT179.DAT","w"); fprintf(wf,"%f\n",countvalue()); fclose(wf); }
writeDAT() { int aa[1000],n,k; FILE *fp; fp=fopen("out185.dat","w"); countvalue(aa,&n); for(k=0;k<n;k++) if((k+1)%10==0) fprintf(fp,"\n"); else fprintf(fp,"%5d",aa[k]); fprintf(fp,"\n"); fclose(fp); }
main() { int aa[1000],n,k; clrscr(); puts(" This program is to find numbers\n which can be divided exactly by 7 or 11,\n but can not be divided exactly both by 7 and 11."); puts(" These numbers less than 1000 are:"); countvalue(aa,&n); for(k=0;k<n;k++) if((k+1)%10==0) printf("\n"); else printf("%5d",aa[k]); writeDAT(); PressKeyToQuit(); }