Posted by speedy11 on 23:18:00 10-03-2001
/* There are errors in this program,, I do not want the program altered in any way
as I won't learn that way */
/* All I need is to know is what line the errors are on, and explain why they are
errors please so I can correct the program myself
THANKS */
/* Hi_Low&Average.C */
#include
void main()
{
int hi, low, number , num_count, value,
average, total;
/* set hi to owest integer value and low to highest
integer so that they will change */
hi = -32768;
low = 32767;
number = 0 = num_count = 0 = total = 0;
/* test to ensure number of inputs is positive */
while ( number ");
scanf("%d" ,&number);
if( number 1\n");
}
/* loop for input of numbers */
for( num_count = 0, num_count ", num_count+1);
scanf ("%d" , &value );
/* test for highest and lowest values */
switch ( value )
{
case value --> hi : hi = value;
break;
case value [ This Message was edited by: LlamaDolittle on 2001-10-04 05:22 ]
Posted by Sebi on 18:25:00 10-04-2001
yeah, i thought too u need like
#include
for example
#include <iostream.h>
[ This Message was edited by: Peter on 2001-10-04 21:25 ]
Posted by Govtcheez on 19:16:00 10-04-2001
Also, ANSI standard says that main returns an integer, NOT VOID! (as some teachers and books say, for some reason)
Posted by Sebi on 20:16:00 10-04-2001
that made me wonder, too.
i thought it is
int main()
not
void main
because int defines main as an integer or so, but void would make it empty?
Posted by Govtcheez on 20:26:00 10-04-2001
Void would make it empty? I guess I don't follow...
I was just saying change from void main() to int main() (and insert the return 0 at the end, of course)...
Posted by LlamaDolittle on 07:51:00 10-05-2001
You shouldn't use void main(), it isn't an error on most compilers, but it can cause bad things to happen to your program. Under the C++ standard using void main() is prohibited, but I believe that most, if not all, compilers will turn void main() into int main() during compilation.
Posted by Govtcheez on 14:03:00 10-05-2001
Even if it does change it during compilation, you'll still lose the chance to actually pass a value back to the OS...
Posted by Sebi on 16:34:00 10-07-2001
what i ment is since you can do for example:
int main(void)
where the void tells that there is no parameter, that its empty. as in 0 or nothing.