|
|
Invisible escribió:
>>> (BTW, I thought printf() was only for C, not C++?)
>>
>> Well it is for C, but anything you can do in C you can do in C++. Not
>> that it's a good idea though...
>
> Ah yes, C++ is a superset of C. But I was thinking (hoping?) that in C++
> you have something less hellish than prinf() to play with...
You do.
C:
printf("Number is: %d\n", somenumber);
...and be careful types match between format string and arguments
passed, and particularly that you passed *enough* arguments
C++:
cout << "Number is: " << somenumber << "\n";
...and there is no duplicated information that could get out-of-sync
(format and arguments).
It's just you can still use the C way if you want to.
Post a reply to this message
|
|