#include <stdio.h>
main()
{
int ctr, bin, quotient, deci=0, binary,octal,hexa;
float rem;
char mark_magic;
clrscr();
do
{
clrscr();
quotient = 1;
binary = 1;
gotoxy(32,3); printf("-=< MAIN MENU >=-");
gotoxy(15,5); printf("from any Number System to Decimal System conversion");
gotoxy(5,6); printf("------------------------------------------------------------------------");
gotoxy(5,7); printf("------------------------------------------------------------------------");
gotoxy(26,9); printf("[A] Binary System");
gotoxy(26,11); printf("[B] Octal System");
gotoxy(26,13); printf("[C] Hexadecimal System");
gotoxy(26,15); printf("[X] Exit");
gotoxy(26,21); printf("what's your choice?: ");
mark_magic = getche();
clrscr();
switch(toupper(mark_magic))
{
case 'A':
clrscr();
gotoxy(10,5); printf("########^_^ Convert Decimal system to Binary system ^_^########");
gotoxy(5,6); printf("------------------------------------------------------------------------");
gotoxy(5,7); printf("------------------------------------------------------------------------");
binary = 2;
gotoxy(28,9);printf("enter decimal number: ");
scanf("%d",&deci);
quotient = deci / binary;
for(bin=1;bin>=15;bin++)
{
bin = deeci%2;
gotoxy(28,11);printf("Equivalent in Binary is %.0f",bin);
}
gotoxy(51,24); printf("press any key to exit: ");
getche();
clrscr();
break;
case 'B':
clrscr();
gotoxy(10,5); printf("########^_^ Convert Decimal system to Octal system ^_^########");
gotoxy(5,6); printf("------------------------------------------------------------------------");
gotoxy(5,7); printf("------------------------------------------------------------------------");
octal = 8;
gotoxy(28,9);printf("enter decimal number: ");
scanf("%d",&deci);
for (ctr = 1; ctr<=deci; ctr++)
quotient = deci / octal;
gotoxy(28,11);printf("Equivalent in Octal is %d",quotient);
gotoxy(51,24); printf("press any key to exit: ");
getche();
break;
case 'C':
clrscr();
gotoxy(10,5); printf("########^_^ Convert Decimal system to Hexadecimal system ^_^########");
gotoxy(5,6); printf("------------------------------------------------------------------------");
gotoxy(5,7); printf("------------------------------------------------------------------------");
hexa = 16;
gotoxy(28,9);printf("enter decimal number: ");
scanf("%d",&deci);
for (ctr = 1; ctr<=deci; ctr++)
quotient = deci / hexa;
gotoxy(28,11);printf("Equivalent in Hexadecimal is %d",quotient);
gotoxy(51,24); printf("press any key to exit: ");
getche();
break;
}
}
while(toupper(mark_magic) != 'X');
}
this was rejected by my teacher,she said a lot of codes is missing. the problem is, I don't know what i'm going to write coz im new with C. Can you pls. help me with my problem?
thanks a lot!