Joined
Last Seen
0 Reputation Points
Unknown Quality Score
No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
0 Endorsements
Ranked #55.0K
2 Posted Topics
Re: printf function
[QUOTE=denethor;1750062]Hello, I have this code: [CODE] #include <iostream> #include <string> void main() { std::string a = "Sample"; printf("%s", a); std::cin.get(); } [/CODE] and it prints some I think random letters. Where i made mistake? And how should i change the code to write "Sample"? Thanks for answers and sorry for …
[QUOTE=pywriter;1750029]I wanna know how can I read a string from input which contains spaces and by string,I mean a string class object. thanks[/QUOTE] Use the getline() function. For instance, if you have [CODE]string str;[/CODE] then use [CODE]getline(cin, str);[/CODE]
The End.
phil_alloy