C programming help
1
Name:
op
2011-11-05 15:22
Hey guys a avid python lover here. I'm reading K and R and I'm wondering why the fuck does this not work? thanks for any help
#include <stdio.h>
main()
{
float k, c, f;
int step, low;
f = 0;
step = 10;
while (f <= 1000)
{
c = ((f - 32) / 1.8);
k = (c + 273.15);
printf("%d degrees farhienheit is equal to %d degrees celcius and %d degrees kelvin\n", f, c, k);
f += step;
}
getchar();
}
2
Name:
Anonymous
2011-11-05 15:25
because it's not python
3
Name:
Anonymous
2011-11-05 15:28
getchar();
ISHYGDDT
4
Name:
Anonymous
2011-11-05 15:29
>>3
Fixed:
#include <stdio.h>
main()
{
float k, c, f;
int step, low;
f = 0;
step = 10;
while (f <= 1000)
{
c = ((f - 32) / 1.8);
k = (c + 273.15);
printf("%d degrees farhienheit is equal to %d degrees celcius and %d degrees kelvin\n", f, c, k);
f += step;
}
system("PAUSE");
}
5
Name:
Anonymous
2011-11-05 15:33
What isn't working?
6
Name:
Anonymous
2011-11-05 16:00
the vaule of f isn't increading
7
Name:
Anonymous
2011-11-05 16:28
the value of f isn't increasing anyone know why?
8
Name:
Anonymous
2011-11-05 16:52
mfw when noone on prog can code -_-
9
Name:
Anonymous
2011-11-05 17:08
>>7
#include <stdio.h>
int main(void)
{
double k, c, f;
int step;
f = 0;
step = 10;
while (f <= 1000)
{
c = (f - 32) / 1.8;
k = c + 273.15;
printf("%g degrees farhienheit is equal to %g degrees celcius and %g degrees kelvin\n", f, c, k);
f += step;
}
getchar();
return 0;
}
10
Name:
VIPPER
2011-11-05 17:12
>>8
May
THE JEWISH ANAL RAPE OF DOOM last a trillion melenia fo you.
11
Name:
Anonymous
2011-11-05 17:14
>>8
/prog/ is about getting duubzz!
12
Name:
Anonymous
2011-11-05 17:24
>>8
I can!
trolling is just so much more fun
!
13
Name:
Anonymous
2011-11-05 18:17
holy shit thanks /prog/
14
Name:
Anonymous
2011-11-05 18:34
>>13
I am not
/prog/ , I am from
/g/ .
15
Name:
Anonymous
2011-11-05 20:15
(define (main f step)
(if (<= f 1000)
(let ((c (/ (- f 32) 1.8)))
(display f)
(display " degrees farhienheit is equal to ")
(display c)
(display " degrees celcius and ")
(display (+ c 273.15))
(display " degrees kelvin")
(newline)
(main (+ f step) step))))
(main 0 20)
16
Name:
Anonymous
2011-11-05 20:29
>>15
Perl:
say("hell")
Lisp:
(display "hell") (newline)
that is why Lisp unpopular
17
Name:
Anonymous
2011-11-05 20:59
Sperm A style formatting is terser
(printf "~a degrees farhienheit is equal to ~a degrees celcius and ~a degrees kelvin~n"
f c (+ c 273.15))
18
Name:
Anonymous
2011-11-05 21:10
>>16
(define (say something) (display something) (newline))
(say "hello")
That's was so difficult, I bet none of the Lisp programmers ever thought of it.
19
Name:
Anonymous
2011-11-05 21:19
>>17
(printf
What happened to
format?
20
Name:
Anonymous
2011-11-05 21:21
>>19
Lispers finally agreed that C/C++ functions are superior. Just wait till they implement
public-void-static-class-faggotry
21
Name:
Anonymous
2011-11-05 21:24
>>17
print("$f degrees farhienheit is equal to $c degrees celcius and $(+ c 273.15) degrees kelvin~n")
even PHP owns Lisp.
22
Name:
Anonymous
2011-11-05 21:34
>>19
Not sure about the other Schemes but in Racket
format returns a formatted string instead of printing to
(current-output-port).