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 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 PostYes, code tags and indentation/formatting. See previous link and below:
[code=cplusplus] // code here
[/code]
Here's your code. Much easier to read.
// Conversation #include <iostream> #include <string> using namespace std; int main() { string feeling; char reason[10]; string name; const int speed = …
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
tux4life 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.