print "Hello World!"

Author Topic: print "Hello World!"  (Read 3373 times)

welcome to the forums, try not to create too many jokes as some people take them too literally, which will just end up giving you brain hurt

*cough* pacnet *cough*

(Should have specified, I was talking LUA In the post name.)
« Last Edit: February 26, 2014, 03:20:34 PM by LegoFish »

Welcome to the forums.  It's fine if you go in drama, however don't be an idiot and mainly - familiarize yourself with the impossible people before trying to argue with them as you will find there is quite a bit of these type of people.

hello there
welcome to the forums!

hello i hope you become a great addition to the community

1: There's no semicolon on line 5
2: You should not return 42 for main(), a common practice is to return 0
3: Iostream (std::cout << x) is better than printf

EDIT: Sorry. I just had to...
look at me guys im a great programmer

it automatically knows what youre printing
with printf you have to define if its a float, string or integer ect

+ i think its easier to overload it
You don't have to define if it's a float, string, or integer with printf. int num = 5; printf(num); will print "5". Printf also doesn't use a buffer, so you can't overflow the function any more than you can overflow cout. I assume you mean overflow, because an overload is something entirely irrelevant to printing anything.

You don't have to define if it's a float, string, or integer with printf. int num = 5; printf(num); will print "5". Printf also doesn't use a buffer, so you can't overflow the function any more than you can overflow cout. I assume you mean overflow, because an overload is something entirely irrelevant to printing anything.
overloading the operators >> or << and changing the way they print certain variables

also i was referring to
Code: [Select]
int number = 12;
printf("%f", number); //gives a value of 'nan'
std::cout << number;
cout knows the variable number is an integer, printf will not know how to do that unless you define it, the automatic process from cout stops you from making silly mistakes like above

also if you do just printf(number) you get an error saying 'cannot convert "int" to "const char*"'

i guess its more of a personal preference but i see more benefits to cout

ok guys this has gone too far

Code: [Select]
exit;

I'm not an alternate account, but I'll be aware.
Oh shiz, he's "Aware"'s alt! Loljk have fun!

Yo, everyone who's posting on C++.

This is Ruby.

Welcome to the forums.
I am Nonnel, friend of the knees.

ok guys this has gone too far

Code: [Select]
exit;
syntax error on line 1: unknown keyword "exit"


Code: [Select]
int number = 12;
printf("%f", number); //gives a value of 'nan'
std::cout << number;
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.