C hw help (absolutely new)

March 11, 2010 at 17:18:53
Specs: Windows XP
Hello everybody,
I need so much help with my hw. Had three weeks to finish this and on Monday i have to present.
Should: "Enter three real numbers a,b,c. Output y=max(min(a,b),c)".
I am absolutely new to programming and spent hours on this, but done nothing. It's even impossible to find min...
Can someone help..?
PS.: Sorry for my English.

See More: C hw help (absolutely new)

Report •

March 11, 2010 at 17:30:54
Start with pseudo-code, like this:

clear screen
show instructions
get input
do the math
show result

Helping others achieve escape felicity


Report •

March 11, 2010 at 18:32:01
You said you had three weeks - post the code that you have (whatever it may be) and we'll help.

But, no, we won't write the whole thing for you.

Report •

March 12, 2010 at 02:41:22

Report •

Related Solutions

March 12, 2010 at 07:35:36
Looks good for me, but I'm not expert there. What happens when you omit "using namespace std;" ?

"double" can be replaced with "int", but obviously the range of allowed numbers, changes. Tell us what kind of numbers you need (100, 1 million, ... ?) as a max.

Report •

March 12, 2010 at 08:32:34

Report •

March 12, 2010 at 08:37:43
"using namespace std;" works fine, but I am curious why I can't use something instead of it?
"int" & "float" doesn't seam to give the right answer. (numbers should be till 1000).
And why "df" doesn't work and there have to be "lf"?

Report •

March 12, 2010 at 15:41:24
Are you writing in C or C++? It seems you are using C style
programming, but using a C++ compiler, and getting

To use C, the header file is not <cstdlib> but <stdlib.h> and
<iostream> is available only in C++. You haven't included the
header file required for printf and scanf. Look these two
functions up in your reference material, and see what header
you need to include.

"using namespace" is a C++ statement, and not valid in C. If
you rename your source file to a .c extension, you'll get a
syntax error message if you use C++.

Your task is to input "real" numbers. This implies either
double or float, but not int. (Unless it means real as opposed
to imaginary or complex, but I doubt it.)

If you are going to use float instead of double, you will need to
adjust the first argument to scanf, to tell it that you are
assigning to a float. Note that you don't need to change the
specification for printf (unlike scanf). Extra points (to your own
self-esteem at least) if you can find out why.

Finally, you asked why "df" doesn't work. In what text book or
reference guide did you see "df" mentioned?

Report •

Ask Question