|
-
Feb 1st, 2002, 11:01 PM
#1
Thread Starter
Hyperactive Member
printf
i just came across the functions printf () and scanf ()...i didn't know what they were so i looked at them...after a bit i started really liking them compared to cout and cin.. is there a problem with me using those functions instead of cout and cin? (or a few other C functions as opposed to the ones in C++)?
is it a bad thing? i thought that if i liked using these better then why not..
anyways i just want to know what the experts have to tell me.. 
thanks in advance
Amon Ra
Amon Ra
The Power of Learning.
-
Feb 1st, 2002, 11:13 PM
#2
Fanatic Member
Not a bad thing, but using printf() as opposed to cout might make the final .exe smaller
Alcohol & calculus don't mix.
Never drink & derive.
-
Feb 2nd, 2002, 01:25 AM
#3
Thread Starter
Hyperactive Member
ok, so i think i will stick with them..
thanks
Amon Ra
Amon Ra
The Power of Learning.
-
Feb 2nd, 2002, 05:38 AM
#4
Hyperactive Member
they do not have as much features as cout
-
Feb 2nd, 2002, 09:18 AM
#5
Monday Morning Lunatic
You should use cout/cin in C++ programs, since printf and scanf are laughably non-type-safe.
And also, you can't overload the % flags in printf to output your own objects, but you can in C++:
Code:
cout << myobject << endl;
Trust me, use the streams.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 2nd, 2002, 01:24 PM
#6
Fanatic Member
i like printf and scanf better because they're easier to use
PHP Code:
printf("you entered %s and %s\n", string1, string);
cout<<"you entered "<<string1<<" and "<<string2<<endl;
scanf("%[a-z]", &cLetter);
//im not sure how to input only letters using the streams
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Feb 2nd, 2002, 02:46 PM
#7
Fanatic Member
Another thing, like parksie said, is cout is "type-safe", meaning you can basically print any variable without having to know its type (no %s, %d, etc.) or overload the << operator for your own classes.
Alcohol & calculus don't mix.
Never drink & derive.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|