Im new at C++ and am trying to teach myself. I want to ask the user of the program why they are feeling a certain way, but not do anything with the sentece. So its like
-how are you feeling?-
user -good-
-why are you feeling good?-
user- blah blah blah-
-ok i understand now-
dsladev
-13
Unverified User
Recommended Answers
Jump to PostWell, unless you're going to add some artificial intelligence to this, simply put a load of predetermined questions / answers in and apply them to an if / switch statement.
Jump to Posti got the program all situated.. i just need to know what to do with that one sentence... i have if/while/switch and all that in there..
Post the code. We can't comment on what we can't see.
Jump to PostIt's not that getline isn't working, it's that you're using cin & then using getline, what is happening is the \n delimiter used in cin, for example when you put that you're feeling good, you press enter, at that point \n is in the buffer.
When you use getline …
All 10 Replies
William Hemsworth
1,339
Posting Virtuoso
dsladev
-13
Unverified User
VernonDozier
2,218
Posting Expert
Featured Poster
dsladev
-13
Unverified User
dsladev
-13
Unverified User
kvprajapati
1,826
Posting Genius
Team Colleague
VernonDozier
2,218
Posting Expert
Featured Poster
dsladev
-13
Unverified User
Yiuca
33
Junior Poster in Training
mvmalderen
commented:
Useful post :)
+9
dsladev
-13
Unverified User
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.