Advertisement
ASP_Volume3 DirectX #48616

DirectX Plug - Simplified DirectDraw Programming

Use this code as a starting point for creating a directdraw application. All the directX code has been shoved to the side and put into a nice neat little package. The result, you can start writing your DirectDraw app in minutes without getting your hands dirty!

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
Upload

#include<stdio.h>
#include<conio.h>
#include<math.h>

int main(void)
{
 int i=0,j=0,sum=0,n,tmp,tmp1;
 long int arr[5];
 char pch;
 clrscr();
 printf("Enter binary number : ");
 while (scanf("%d",&n) != 1)
			 {
				while ((pch = getchar()) != '\n')
					  putchar(pch); // dispose of bad input
				 printf(" is not an binary number.\nPlease enter a ");
				 printf("binary value, such as 100, 1011, or 1111: ");
			 }
 while(n!=0)
	{
		arr[i]=n%10;
		n=(n-arr[i])/10;
		tmp=i;
		i++;
	}
 if(i>=5)
	{
		printf("\n\tNumber Out Of Range");
		getch();
		exit(0);
	}
 for(j=0;j<=tmp;j++)
	if(arr[j]!=1&&arr[j]!=0)
	{
		printf("Enter binary no. only");
		getch();
		exit(0);
	}
 tmp1=tmp;

 for(j=0;j<=tmp;j++)
	{
		sum=sum+(arr[j]*(pow(2,tmp1)));
		tmp1--;
	}
 printf("\nEquivalent decimal number is %d",sum);
getch();
return 0;
}
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine