IM HERE AGAIN

CAN YOU HELP ME PLSS :)

i USEd to make a program that will asked the user to enter 7-digits number

i should determine the largest,smallest,median and the average.Display also the entered number and its equivalent to binary, octal and hexadecimal value

example
THE ouput must be:

largest 7
smallest 1
median 4
average 2.5

you entered********************BINARY******************OCTAL****************HEXA********
****1***************************001**********************1*******************1**********
****2***************************010**********************2*******************2**********
UPTO THE SEVEN DIGITS THAT YOU ENTERED
****7***************************111**********************7*******************7**********

AS OF KNOW I GOT THE BINARY and the seven digit

MY PROBLEM IS WHERE I SHOULD PUT THE OCTAL AND HEXA PLSS HELP

ERROR.CPP

Recommended Answers

All 10 Replies

the code is the error.cpp i dont know how to use the toggle paint sorry :(

Can you post some code...

Here is his code :

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

int main()
{
char wew[7];
int smallest, largest, middle, intNo;
int dividend=0; int modolus=0;
int valid;

do {
printf("Enter a seven digit number:\n");
scanf("%s", wew);

valid=0; // counter for no of digits
for (int a=0;a< sizeof(wew);a++)
{
intNo=(int)wew[a]-48; // trap if 0-9
if (intNo>=0 && intNo<10) // trap invalid other than 0 to 9
valid++; // increment counter
}
printf("valid=%d\n",valid);

} while (valid!=7); // repeat if counter is not equal to 7

for (int a=0;a<sizeof(wew);a++)
{
intNo=(int)wew[a]-48;

if (intNo>=0 || intNo<10) // trap invalid other than 0 to 9
{
printf("You Entered=%d, ",intNo);

if (a==0)
{
smallest=intNo;
largest=smallest;
}
else
{
if (a==3)
middle=intNo;
if (intNo<smallest)
smallest=intNo;
if (intNo>largest)
largest=intNo;
}

// compute binary

printf("binary=");
do {
modolus=intNo %2;
dividend=intNo/2;
intNo=dividend;
printf("%d",modolus);
} while(dividend!=0);
printf("\n");

}
else



printf("None Entered\n");

}

printf("\nSmallest=%d\n",smallest);
printf("Largest=%d\n",largest);
printf("Middle=%d\n",middle);
printf("Average=%d\n",(smallest+largest+middle)/3);

float intDec=0; // initialize

for (int b=sizeof(wew);b>0;b++)
{

}

getch();
clrscr();
return 0;
}

I would help, but first its C code. And bad code like this makes me mad.

but i used c++ and its work

i using turbo c

i using turbo c

Yeah, that is why! Many students are forced to use that old man :)

im just 15 years old babby :)

im just 15 years old babby :)

Thats using a 15 year old compiler. Get with the modernization and use visual studio or something.

Thats using a 15 year old compiler. Get with the modernization and use visual studio or something.

CodeLite is my suggestion. Man, it have no express edition ;)

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.