#include <iostream.h>
char first[ 20 ];
char middle[ 20 ];
char last[ 20 ];
main()
{
cout << "What is your name ScumBag? ";
cin >> first >> "\n" >> middle >> "\n" >> last;
return 0;
}
NewKidWalking
0
Newbie Poster
Recommended Answers
Jump to Postremove the "\n"s -- that is only for cout. Not allowed to have literals (text in quotes) on the cin line.
Jump to Post>There is some syntax of cin that allowes us to ignore the \ns.. Isn't it?
You're probably thinking of the ws manipulator, but it discards all whitespace. If you want more control, you have to write your own manipulator:class scan { public: scan ( const char …
All 7 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
NewKidWalking
0
Newbie Poster
thekashyap
193
Practically a Posting Shark
Narue
5,707
Bad Cop
Team Colleague
thekashyap
commented:
Thanks for the insights, though i'm not a big fan or cin/cout it's good to learn more :)
+1
~Ken Esquire~
0
Newbie Poster
jbennet
1,618
Most Valuable Poster
Team Colleague
Featured Poster
iTaChi
19
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.