Ok this program is almost done. Some correction are still needed. Can anyone here put this in character array.

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


char value;
char t, u, v;
char answer;

void Binary2Decimal()
{
gotoxy(1,9);printf("[BINARY TO DECIMAL CONVERSION]");


char b2,f2=1,d2=0;
gotoxy(1,11);printf("Enter a Binary number: ");
scanf("%d", &b2);

printf("\n\n");

while(b2>0)
{
if((b2%10)==1)
{
d2=d2+f2;
}
b2=b2/10;
f2=f2*2;
}
printf("Decimal equivalent is: ", &d2);

}

void Octal2Decimal()
{
gotoxy(1,9);printf("[OCTAL TO DECIMAL CONVERSION]");


char number4,dec7,rem7,i7,sum7;
gotoxy(1,11);printf("Enter an Octal number: ");
scanf("%o", &number4);

printf("\n\n");

dec7=printf("%d", number4);

{
rem7=dec7%8;
sum7=sum7 + (i7*rem7);
}

printf("Decimal equivalent is: %d", number4);

}

void Hexa2Decimal()
{
gotoxy(1,9);printf("[HEXADECIMAL TO DECIMAL CONVERSION]");


char number1,dec8,rem8,i8,sum8;
gotoxy(1,11);printf("Enter a Hexadecimal number: ");
scanf("%d", &number1);

printf("\n\n");

dec8=printf("%d", &number1);

{
rem8=dec8%16;
sum8=sum8 + (i8*rem8);
}

printf("Decimal equivalent is: %d", &number1);

}
int main()

{

do{
clrscr();

printf("Conversion from any base to base 10");


gotoxy(1,3);printf("a - Binary");
gotoxy(1,4);printf("b - Octal");
gotoxy(1,5);printf("c - Hexadecimal");


gotoxy(1,7);printf("Select a value to be converted: ");
scanf("%c", &value);

switch(value){
case 'a':
Binary2Decimal();
break;
case 'b':
Octal2Decimal();
break;
case 'c':
Hexa2Decimal();
break;
default:
printf("Wrong input");
}

gotoxy(1,16);printf("Do you want to continue NUMBER CONVERSION?(y/n) ");
scanf("%c", &answer);
}

while(answer == 'y');
getch();
}

See other post ...

Please ensure all your example code is placed with indenting preserved.

NO one wants to try to read C++ code that has NO proper indentation !!!

Avoid indiscriminate use of global variables.

Use descriptive variable names.

Declare your variables just before used with sufficent scope only as needed.

Avoid NON portable code ...
(an example of NON portable code is code that uses conio.h and windows.h)

DO NOT EXPECT people to have an ancient version of a C++ compiler (like Turbo C++) to check your code ... if you wish help from people who are using up-to-date C++ compilers ... you WILL have to adjust the code yourself to work on an old non-standard compiler ... AND ...provide code for us to see and test and mend ... that is designed to compile ... and so will compile ... on a present day standard C++ compiler!

Sir I just read the other post here. I didn't understand a thing. My problem with is program is that it's not in character array and Binary2Decimal conversion when I input a binary number it will go stright to "Do you want to continue NUMBER CONVERSION?(y/n) it's not supposed to do that it must a appear am answer in "Decimal equivalent is: ". And in Hexa2Decimal I really don't what is the problem here the formula is correct but Im always getting an -15 answer. And finaly here "Do you want to continue NUMBER CONVERSION?(y/n) " it exit when I type any character it doesn't go in the loop.

Sorry sir but Turbo C++ is what we are using in our school. And my prof won't accept any up-to-date code. I don't know why she doesn't allow us to use up-to-date codes.

Did you test / see the effect of all the added ?

flushStdin();

After all the input ... to ensure that stdin is always flushed BEFORE you try to get any NEXT input ...

Try the FIXED /edited example program out ... and SEE!

I got an answer but the answer is the left side. For example when input AE the answer is (174Decimal equivalent is: -18). What's wrong with my statement? Why the asnwer is in the left side and why is there a -18 in the right side?

This was the output I got of the code I sent you:

Conversion from any base to base 10
a - Binary
b - Octal
c - Hexadecimal
Select a value to be converted: c
[HEX TO DECIMAL CONVERSION]
Enter a Hex number: ae

174
Decimal equivalent is: 174

The answer is right. But it is in the wrong position 174Decimalquivalent is: -18. This just the same in the Octal2Decimal.

Ok I solve the Octal2Decimal & Hexa2Decimal. Now in Binary2Decimal when I input a binary number it skip the "Decimal Equivalent is: " it will go straight to the
"Do you want to continue NUMBER CONVERSION?(y/n) ".

Ok 4 more correction to go. #1 How can I put this program in a character array? #2 Binary2Decimal when I input a binary number it skip the "Decimal Equivalent is:" it will go straight to the "Do you want to continue NUMBER CONVERSION?(y/n)". #3
In "Do you want to continue NUMBER CONVERSION?(y/n)" it will not go to looping and I don't know why? #4 In Octal2Decimal & Hexa2Decimal I always an answer like this "AnswerDecimal Equivalent is: Answer" it should be "Decimal Equivalent is: Answer". Please help me correct this. NOTE THIS IS "TURBO C++".

Re ... char (C++ string) input ...
Did you ever think to look here ?

LOOK Here

No sir. The code there are up-to-date and we only use old version codes. And it's better to make my own program rather than copying to someone's program.

Please correct my errors here :( in Turbo C++

Ok 4 more correction to go. #1 How can I put this program in a character array? #2 Binary2Decimal when I input a binary number it skip the "Decimal Equivalent is:" it will go straight to the "Do you want to continue NUMBER CONVERSION?(y/n)". #3
In "Do you want to continue NUMBER CONVERSION?(y/n)" it will not go to looping and I don't know why? #4 In Octal2Decimal & Hexa2Decimal I always an answer like this "AnswerDecimal Equivalent is: Answer" it should be "Decimal Equivalent is: Answer". Please help me correct this. NOTE THIS IS "TURBO C++".

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


char value;
char t, u, v;
char answer;

void Binary2Decimal()
{
gotoxy(1,13);printf("[BINARY TO DECIMAL CONVERSION]");

long b2,f2=1,d2=0;
gotoxy(1,15);printf("Enter a Binary number: ");
scanf("%d", &b2);

printf("\n");

while(b2>0)
{
if((b2%10)==1)
{
d2=d2+f2;
}
b2=b2/10;
f2=f2*2;
}
printf("Decimal equivalent is: ", d2);
}

void Octal2Decimal()
{
gotoxy(1,13);printf("[OCTAL TO DECIMAL CONVERSION]");

long number4,dec7,rem7,i7,sum7;
gotoxy(1,15);printf("Enter an Octal number: ");
scanf("%o", &number4);

printf("\n");

dec7=printf("%d", number4);
{
rem7=dec7%8;
sum7=sum7 + (i7*rem7);
}
printf("Decimal equivalent is: %d", number4);
}

void Hexa2Decimal()
{
gotoxy(1,13);printf("[HEXADECIMAL TO DECIMAL CONVERSION]");

long hex,dec8,rem8,i8,sum8;
gotoxy(1,15);printf("Enter a Hexadecimal number: ");
scanf("%X", &hex);

printf("\n");

dec8=printf("%d", hex);
{
rem8=dec8%16;
sum8=sum8 + (i8*rem8);
}
printf("Decimal equivalent is: %d", hex);
}

void main()

{
do{
clrscr();
gotoxy(1,3);printf("Conversion from any base to base 10");
gotoxy(1,5);printf("a - Binary");
gotoxy(1,6);printf("b - Octal");
gotoxy(1,7);printf("c - Hexadecimal");
gotoxy(1,11);printf("Select a value to be converted: ");
scanf("%c", &value);

switch(value){
case 'a':
Binary2Decimal();
break;
case 'b':
Octal2Decimal();
break;
case 'c':
Hexa2Decimal();
break;
default:
printf("Wrong input");
}

gotoxy(1,20);printf("Do you want to continue NUMBER CONVERSION?(y/n) ");
scanf("%c", &answer);
}

while(answer == 'y');
getch();
}
commented: Desipte our prior requests, you still are not indenting your code. -2

Unfortunately, you still aren't indenting your code, making it virtually impossible to read the program. Allow me to (once again) run your code through Astyle and format it sensibly:

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


char value;
char t, u, v;
char answer;

void Binary2Decimal()
{
    gotoxy(1,13);
    printf("[BINARY TO DECIMAL CONVERSION]");

    long b2,f2=1,d2=0;
    gotoxy(1,15);
    printf("Enter a Binary number: ");
    scanf("%d", &b2);

    printf("\n");

    while(b2>0)
    {
        if((b2%10)==1)
        {
            d2=d2+f2;
        }
        b2=b2/10;
        f2=f2*2;
    }
    printf("Decimal equivalent is: ", d2);
}

void Octal2Decimal()
{
    gotoxy(1,13);
    printf("[OCTAL TO DECIMAL CONVERSION]");

    long number4,dec7,rem7,i7,sum7;
    gotoxy(1,15);
    printf("Enter an Octal number: ");
    scanf("%o", &number4);

    printf("\n");

    dec7=printf("%d", number4);
    {
        rem7=dec7%8;
        sum7=sum7 + (i7*rem7);
    }
    printf("Decimal equivalent is: %d", number4);
}

void Hexa2Decimal()
{
    gotoxy(1,13);
    printf("[HEXADECIMAL TO DECIMAL CONVERSION]");

    long hex,dec8,rem8,i8,sum8;
    gotoxy(1,15);
    printf("Enter a Hexadecimal number: ");
    scanf("%X", &hex);

    printf("\n");

    dec8=printf("%d", hex);
    {
        rem8=dec8%16;
        sum8=sum8 + (i8*rem8);
    }
    printf("Decimal equivalent is: %d", hex);
}

void main()

{
    do {
        clrscr();
        gotoxy(1,3);
        printf("Conversion from any base to base 10");
        gotoxy(1,5);
        printf("a - Binary");
        gotoxy(1,6);
        printf("b - Octal");
        gotoxy(1,7);
        printf("c - Hexadecimal");
        gotoxy(1,11);
        printf("Select a value to be converted: ");
        scanf("%c", &value);

        switch(value) {
        case 'a':
            Binary2Decimal();
            break;
        case 'b':
            Octal2Decimal();
            break;
        case 'c':
            Hexa2Decimal();
            break;
        default:
            printf("Wrong input");
        }

        gotoxy(1,20);
        printf("Do you want to continue NUMBER CONVERSION?(y/n) ");
        scanf("%c", &answer);
    }

    while(answer == 'y');
    getch();
}

I cannot emphasize this matter enough; the fact that your professor is accepting unformatted code is a disturbing confirmation that she isn't fit to teach programming, IMAO - I would not accept such code at all were I teaching this course.

I doubt I or anyone else here will continue helping you if your code is not formatted in some manner that makes it easy to read.

Oh, and to repeat what I asked in the other thread: are you certain this course is covering C++ and not plain C? The fact that it is using the C++ compiler does not mean it is necessarily C++ programs being compiled.

commented: More than helpfull +15

Ok sir. I will follow the standard indent. My corrections hasn't been fix.

OK, let's take a closer look at the Binary2Decimal() function and see what we find.

void Binary2Decimal()
{
    gotoxy(1,13);
    printf("[BINARY TO DECIMAL CONVERSION]");

    long b2,f2=1,d2=0;
    gotoxy(1,15);
    printf("Enter a Binary number: ");
    scanf("%d", &b2);

    printf("\n");

    while(b2>0)
    {
        if((b2%10)==1)
        {
            d2=d2+f2;
        }
        b2=b2/10;
        f2=f2*2;
    }
    printf("Decimal equivalent is: ", d2);
}

Now, you start by asking for the user to enter a number in binary - that is to say, a string of ones and zeroes. However, you then have the scanf() function read in a value which is being interpreted as an int, as a decimal number, and putting that value into a long. This means that the value is not being treated as binary. Even if you had told the function to interpret the value as a binary, it would read it into the long as a two's complement binary representation. All well and good, except you then try to treat that number as if it were a character string! In essence, you are confusing two different representations of the same data, the same as if you had confused the word 'Manila' with the city of Manila.

What you want to do, first off, is change the declaration of the variable that you are reading the value into. Let's use a better variable name while we're at it:

char binary_rep[33];   // enough to hold 32 bits, plus one delimiter

Here I've declared a 33 element array of characters, which we'll use to hold our input string. Why 33? Because in C, strings are represented as arrays with a zero character ('\00') marking the end of the string, a format also called ASCIIZ (ASCII zero). You need at least one character more than the maximum size of your array to use it as a string safely. Since a long in Turbo C++ is 32-bits, 33 is exactly the right size to hold a binary value.

Now you want to change how you are reading it in:

scanf("%32s", binary_rep);

Note that you don't need (or even want) a redirection operator here - because binary_rep is an array, it automatically gets turned into a pointer to the first element of the array. Note also the use of the size field of the formatting string.

Now let's turn to conversion function itself. What, you don't have a separate function for conversion, you say? We ought to fix that; as a matter of good design, we want to separate the calculations from the user interface as much as we can. So let's write our conversion function now:

long string2long(char* rep, unsigned int base)
{
    unsigned int len, i, digit;
    long sub_result, result = 0;

    len = strlen(rep);  /* get the length of the string */

    for (i = 0; i < len; i++)
    {
        /* take the ASCII value of the digit 
           and subtract it by the ASCII value of '0' */
        digit = rep[i] - '0';
        sub_result = digit * (long) pow(base, len - (i + 1));

        result += sub_result;  /* add sub_result to the rolling total */
    }    

    return result;
}

Note that we did a neat trick here: we set the function up so that it would convert a string in any base less than 10 to a long. If you look at your older code, you'll see that the part that does the conversion is all the same, except the variable names and the base of the number to convert from; this just consolidates it all into a single function, with a parameter for the base.

I haven't tested this, and it doesn't handle hexadecimals or negative numbers yet, nor does it validate the input in any way, so you still have some work to do. Still, this should definitely get you moving in the right direction.

Hmmm sir I try your codes it didn't work. My Octal2Decimal and Hexa2Decimal are working properly but why my Binary2Decimal isn't it doesn't show an answer in "Decimal Equivalent is: ". Sir in my void main() the do while loop is not working.

Take a look at what variables the Octal2Decimal() and Hexa2Decimal() functions are actually printing before you come to the conclusion that your conversion code is correct.

I try to put %d in the "Decimal Equivalent is:" in then I type "101" the answer is "5" that is so very wrong. This so frustrating.

Wait, what? 101(base 2) is 5(base 10). That's correct.

100b = 4   \
              4 + 1 = 5
  1b = 1   /

@_@ ajsfhkajshfkjas Im so stupid I didn't notice it I was focusing on the in the Octal2Dcimal fudge hahahaha. Ok so sir #1 more correction in my "void main() the do while loop is not working be when I enter 'y' it doesn't go in a loop.

First off, as I've told you a few times already, you really want that to be int main(). I know that Turbo C++ accepts void as the type of main(), but even at the time TC++ came out, it was incorrect according to the (then brand-new) ANSI C89 standard. Oh, and don't forget the return 0; at the end of main(), too.

To address the question, I suspect it's a consequence of using scanf(), a function which tends to cause endless trouble. What you need to do is add an small function to eat the garbage that is stuck in the input buffer:

void clear_stdin()
{
    while((c = getchar()) != '\n' && c != EOF);
}

call this after each use of scanf() and you should be able to eliminate some of these problems. Alternately, use fgets() instead, and parse the resulting strings with sscanf() when reading in numbers (that is, when you aren't trying to use your own conversion function to do it).

Sir it didn't work :( . It didn't work my compiler it says error. I change void main() to int main () and I add return 0; but still it didn't work.

Actually sir this will work properly if I use after the while statement cout<<endl; but it won't allowed my prof she is too old school.

Let's see how it does using fgets() instead, then:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>

#define BUFSIZE 1024

/* function prototypes */
long string2long(char* rep, unsigned int base);
void Binary2Decimal();
void Octal2Decimal();
void Hexa2Decimal();

char buffer[BUFSIZE];

long string2long(char* rep, unsigned int base)
{
    unsigned int len, i, digit;
    long sub_result, result = 0;
    len = strlen(rep) - 1; /* get the length of the string */
    for (i = 0; i < len; i++)
    {
        /* take the ASCII value of the digit
        and subtract it by the ASCII value of '0' */
        digit = rep[i] - '0';
        sub_result = digit * (long) pow(base, len - (i + 1));
        printf("%d\n", sub_result);
        result += sub_result; /* add sub_result to the rolling total */
    }
    return result;
}

void Binary2Decimal()
{
    long result;

    printf("[BINARY TO DECIMAL CONVERSION]\n");

    printf("Enter a Binary number: ");
    fgets(buffer, BUFSIZE, stdin);
    result = string2long(buffer, 2);
    printf("\n\n");
    printf("Decimal equivalent is: %d\n", result);
}

void Octal2Decimal()
{
    long result;

    printf("[OCTAL TO DECIMAL CONVERSION]\n");

    printf("Enter an Octal number: ");
    fgets(buffer, BUFSIZE, stdin);

    printf("\n\n");

    result = string2long(buffer, 8);

    printf("Decimal equivalent is: %d\n", result);
}


void Hexa2Decimal()
{
    long result;

    printf("[HEXADECIMAL TO DECIMAL CONVERSION]\n");

    printf("Enter a Hexadecimal number: ");
    fgets(buffer, BUFSIZE, stdin);

    printf("\n\n");

    result = string2long(buffer, 2);

    printf("Decimal equivalent is: %d\n", result);
}



int main()
{
    char value;
    char answer;

    do
    {
        printf("Conversion from any base to base 10\n\n");
        printf("a - Binary\n");
        printf("b - Octal\n");
        printf("c - Hexadecimal\n");

        printf("Select a value to be converted: \n");
        fgets(buffer, BUFSIZE, stdin);
        value = tolower(buffer[0]);

        switch(value)
        {
        case 'a':
            Binary2Decimal();
            break;
        case 'b':
            Octal2Decimal();
            break;
        case 'c':
            Hexa2Decimal();
            break;
        default:
            printf("Wrong input");
        }

        printf("Do you want to continue NUMBER CONVERSION?(y/n) \n");
        fgets(buffer, BUFSIZE, stdin);
        answer = tolower(buffer[0]);
    }

    while(answer == 'y');

    return 0;
}

As I said earlier, though, you'll need to modify string2long() to work with hex.

I just noticed (or rather, figured out why it was happening) a problem with the code as above, so here is a fixed version:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>

#define BUFSIZE 1024

/* function prototypes */
long string2long(char* rep, unsigned int base);
void Binary2Decimal();
void Octal2Decimal();
void Hexa2Decimal();

char buffer[BUFSIZE];

long string2long(char* rep, unsigned int base)
{
    unsigned int len, i, digit;
    long sub_result, result = 0;
    len = strlen(rep); /* get the length of the string */
    for (i = 0; i < len; i++)
    {
        /* take the ASCII value of the digit
        and subtract it by the ASCII value of '0' */
        digit = rep[i] - '0';
        sub_result = digit * (long) pow(base, len - (i + 1));
        result += sub_result; /* add sub_result to the rolling total */
    }
    return result;
}

void Binary2Decimal()
{
    long result;

    printf("[BINARY TO DECIMAL CONVERSION]\n");

    printf("Enter a Binary number: ");
    fgets(buffer, BUFSIZE, stdin);
    buffer[strlen(buffer) - 1] = '\0'; /* eliminate the trailing newline */
    result = string2long(buffer, 2);
    printf("\n\n");
    printf("Decimal equivalent is: %d\n", result);
}

void Octal2Decimal()
{
    long result;

    printf("[OCTAL TO DECIMAL CONVERSION]\n");

    printf("Enter an Octal number: ");
    fgets(buffer, BUFSIZE, stdin);
    buffer[strlen(buffer) - 1] = '\0';
    printf("\n\n");

    result = string2long(buffer, 8);

    printf("Decimal equivalent is: %d\n", result);
}


void Hexa2Decimal()
{
    long result;

    printf("[HEXADECIMAL TO DECIMAL CONVERSION]\n");

    printf("Enter a Hexadecimal number: ");
    fgets(buffer, BUFSIZE, stdin);
    buffer[strlen(buffer) - 1] = '\0';
    printf("\n\n");

    result = string2long(buffer, 2);

    printf("Decimal equivalent is: %d\n", result);
}

int main()
{
    char value;
    char answer;

    do
    {
        printf("Conversion from any base to base 10\n\n");
        printf("a - Binary\n");
        printf("b - Octal\n");
        printf("c - Hexadecimal\n");

        printf("Select a value to be converted: \n");
        fgets(buffer, BUFSIZE, stdin);
        buffer[strlen(buffer) - 1] = '\0';
        value = tolower(buffer[0]);

        switch(value)
        {
        case 'a':
            Binary2Decimal();
            break;
        case 'b':
            Octal2Decimal();
            break;
        case 'c':
            Hexa2Decimal();
            break;
        default:
            printf("Wrong input");
        }

        printf("Do you want to continue NUMBER CONVERSION?(y/n) \n");
        fgets(buffer, BUFSIZE, stdin);
        buffer[strlen(buffer) - 1] = '\0';
        answer = tolower(buffer[0]);
    }

    while(answer == 'y');

    return 0;
}

I needed to add some code to strip out the trailing newlines in the input strings.

Thank you sir. But this looks complicated to explain to my prof because some of this codes that you used are new to me. And I don't know what the meaning and function of those codes you used.

Hmmn, I can see the problem there, yes. While I would be glad to explain in detail any unfamiliar library functions or algorithms I used to you, your professor would still question how you happened to learn them yourself. That makes for a difficult situation, and I'm not sure I know how to solve it, as it really doesn't sound to me as if she gave you enough information about how the ones you have used work to solve the problem yourself, without resorting to something like this.

What did the professor explain to you about the I/O functions? Did she cover any of them besides printf() and scanf(), such as getchar() or fgets()? Were the basics of function definitions and calls covered (I can tell that you didn't know them before, but I am not sure if that's because they weren't explained, or because they weren't explained well enough)? Was the algorithm for converting a string representation to an integer given to you (it is unintuitive enough that you couldn't be expected to come up with it on your own)? Did she give any general design advice, such as separation of computation from user interface?

More generally, how does the professor explain things to you, and how does the textbook explain the same material? What resources were you given, or referred to (e.g., cplusplus.com)?

Oh, and to repeat my earlier question, are you certain that the course is on C++, and not C? Despite their common history and backwards compatibility, they really are different languages, and if the course is on C it would explain why the professor didn't want you using code specific to C++, and as I said earlier, the same compiler would often be used for both types of courses.

Sir just compile and run your source code. When I run it the program will repeatively rewrite everything when I type 'y'. Yes they were all covered all the topics but some are not like getchar() or fgets(). All basic algorithms were being explained well. Sir I fix my program but the problem is I need to double enter to enter in a loop. But I only need one enter to continue looping.

Here's my program now. In my switch case default I erase the default but I think this is wrong. Everything is running ok but my looping is not I need press double enter to enter in a loop I only need to press enter onces.

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


char value;
char key;


void Binary2Decimal()
       {
       gotoxy(1,13);printf("[BINARY TO DECIMAL CONVERSION]");

       int bin2,f2=1,d2=0;
       gotoxy(1,15);printf("Enter a Binary number: ");
       scanf("%d", &bin2);

       printf("\n");

       while(bin2>0)
       {
       if((bin2%10)==1)
       {
       d2=d2+f2;
       }
       bin2=bin2/10;
       f2=f2*2;
       }
       printf("Decimal equivalent is: %d", d2);
       }

void Octal2Decimal()
       {
       gotoxy(1,13);printf("[OCTAL TO DECIMAL CONVERSION]");

       int oct8,dec8,rem8,i8,sum8;
       gotoxy(1,15);printf("Enter an Octal number: ");
       scanf("%o", &oct8);

       printf("\n");

       {
       rem8=dec8%8;
       sum8=sum8 + (i8*rem8);
       }
       printf("Decimal equivalent is: %d", oct8);
       }

void Hexa2Decimal()
       {
       gotoxy(1,13);printf("[HEXADECIMAL TO DECIMAL CONVERSION]");

       int hex16,dec16,rem16,i16,sum16;
       gotoxy(1,15);printf("Enter a Hexadecimal number: ");
       scanf("%X", &hex16);

       printf("\n");

       {
       rem16=dec16%16;
       sum16=sum16 + (i16*rem16);
       }
       printf("Decimal equivalent is: %d", hex16);
       }

    void  main()
     {
      do{
       clrscr();
       gotoxy(1,1);printf("Said A. Sayre Jr");
       gotoxy(1,3);printf("Conversion from any base to base 10");
       gotoxy(1,5);printf("a - Binary");
       gotoxy(1,6);printf("b - Octal");
       gotoxy(1,7);printf("c - Hexadecimal");
       gotoxy(1,11);printf("Select a value to be converted: ");
       scanf("%c", &value);

       switch(value){
       case 'a':
       Binary2Decimal();
       break;
       case 'b':
       Octal2Decimal();
       break;
       case 'c':
       Hexa2Decimal();
       break;

       }

       gotoxy(1,20);printf("Press <DOUBLE ENTER> to Continue or Press any key to Exit");
       key=getch();
       }

       while(key == 13);

       }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.