All pastes #159847 Raw Edit

Conversion

public c v1 · immutable
·published 2006-09-03 16:00 UTC
rendered paste body
#include <stdio.h>int main(void)	{	char command[64];   	printf("This is Conversion 0.2.2, written by LazyFIDERook.\n");   	printf("This program takes a decimal number and converts it to other formats.\n \n");   	fflush(stdout);   	printf("Type a decimal number: ");   	scanf("%s", command);   	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 \n");   	while(1)     		{        	printf("Type another number, or type 'quit' to exit: ");        	scanf("%s", command);        	if(!strcmp(command, "quit"))        	        {        	        printf("Are you sure? [Y/N] ");        	        scanf("%s", command);        	        if (!strcmp(command, "y"))        	        	{           			exit(1);           			}           		if (!strcmp(command, "n"))           			{           			printf("Exit Cancelled.\n");           			}           		}        	if(!strcmp(command, "qui"))        	        {        	        printf("Are you sure? [Y/N] ");        	        scanf("%s", command);        	        if (!strcmp(command, "y"))        	        	{           			exit(1);           			}           		if (!strcmp(command, "n"))           			{           			printf("Exit Cancelled.\n");           			}           		}        	if(!strcmp(command, "qu"))        	        {        	        printf("Are you sure? [Y/N] ");        	        scanf("%s", command);        	        if (!strcmp(command, "y"))        	        	{           			exit(1);           			}           		if (!strcmp(command, "n"))           			{           			printf("Exit Cancelled.\n");           			}           		}        	if(!strcmp(command, "q"))        	        {        	        printf("Are you sure? [Y/N] ");        	        scanf("%s", command);        	        if (!strcmp(command, "y"))        	        	{           			exit(1);           			}           		if (!strcmp(command, "n"))           			{           			printf("Exit Cancelled.\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 \n");           		}     		}   	return(0);	}