Blockland Forums > General Discussion
print "Hello World!"
TristanLuigi:
Yo, everyone who's posting on C++.
This is Ruby.
Nonnel:
Welcome to the forums.
I am Nonnel, friend of the knees.
Ipquarx:
--- Quote from: Subpixel on February 26, 2014, 08:37:57 PM ---ok guys this has gone too far
--- Code: ---exit;
--- End code ---
--- End quote ---
syntax error on line 1: unknown keyword "exit"
ßlöükfáce:
y'all are big fat NERDS
$trinick:
--- Quote from: Blockzillahead on February 26, 2014, 07:52:53 PM ---
--- Code: ---int number = 12;
printf("%f", number); //gives a value of 'nan'
std::cout << number;
--- End code ---
--- End quote ---
It actually gives a value of 0, but obviously that code is inherently flawed. You're trying to print an int value as a float value; this is C++. We have stronger typing than your average scripting language, you have to cast number to a float. I still don't see the issue though, if you're confused about what kind of value it is that you're printing just look for the variable initialization and see what type it is. Honestly, if you can't keep track of what type your variables are you probably shouldn't be coding anyway, but that's okay there are plenty of languages like JavaScript that would be happy to convert everything to any variable type automatically without asking you.