All pastes #166213 Raw Edit

Conversion

public c v1 · immutable
·published 2006-09-10 17:46 UTC
rendered paste body
#include <stdio.h>int main(void)	{	char command[64];   	printf("This is Conversion 0.4.2, written by LazyFIDERook.\n");   	printf("This program takes a decimal number and converts it to other formats.\n");   	printf("To view the documentation,type \"help\".\n \n");   	fflush(stdout);   	printf("Type a decimal number:          ");   	scanf("%s", command);   	if(!strcmp(command, "help")||!strcmp(command, "HELP"))   		{   		fopen("readme.txt", "r");   		}   	else   		{   		printf("This is the octal format:       %o\n");		printf("This is the hexadecimal format: 0x%x\n");        	printf("This is the ASCII character:    %c\n");        	{	   	while(1)     		{        	printf("\nType another number, or type \"quit\" to exit: ");        	scanf("%s", command);        	if(!strcmp(command, "help")||!strcmp(command, "HELP"))   			{   			fopen("readme.txt", "r");   			}        	if(!strcmp(command, "quit")||!strcmp(command, "qui")||!strcmp(command, "qu")||!strcmp(command, "q"))        	        {        	        printf("Are you sure? [Y/N] ");        	        scanf("%s", command);        	        if(!strcmp(command, "y")||!strcmp(command, "Y"))        	        	{        	        	printf("Exit Successful.\n");           			exit(1);           			}           		if(!strcmp(command, "n")||!strcmp(command, "N"))           			{           			printf("Exit Cancelled.");           			printf("\n");           			}           		}           	else            		{           		printf("This is the octal format:                    %o\n");           		printf("This is the hexadecimal format:              0x%x\n");           		printf("This is the ASCII character:                 %c\n");           		}     		}   	return(0);	}