Exemple #1
0
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();
}
Exemple #2
0
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();
}
Exemple #3
0
void main()
{
	int i;
	clrscr();
	puts(" This program is to deal with the number from file.");
	puts(" >> The results are:");
	for(i=0;i<MAX;i++)xx[i]=0;
	if(ReadDat())
	{
		printf(" Can't open data file IN182.DAT!\007\n");
		return;
	}
	Compute();
	printf(" There are %d odds.\n There are %d evens.\n The average value of all the odds is %lf.\n The average value of all the evens is %lf.\n The variance of the odds is %lf.\n",odd,even,ave1,ave2,totfc);
	WriteDat();
	PressKeyToQuit();
}
Exemple #4
0
void main()
{
	int i;
	clrscr();
	puts(" This program is to execute Bit Shift Operation.");
	puts(" >> Now reading datas from file......Succeeded!");
	puts(" >> Calculating......Completed!");
	puts(" >> Results are:");
	for(i=0;i<MAXNUM;i++) xx[i]=0;
	if(readdat())
	{
		printf(" Can't open the data file in188.dat!\007\n");
		return;
	}
	calvalue();
	printf(" >> The total number of data in the file is %d.\n",totnum);
	printf(" >> The even number of data after bit shift is %d.\n",totcnt);
	printf(" >> The variance of these even numbers is %.2lf\n",totpjz);
	writedat();
	PressKeyToQuit();
}