i have a code that you enter section after section. when your done, you type end, and it stops asking you to enter in stuff. My problem is, I can get it to detect when I type end.
here is my problem:

cout << "\n\n\nTo start, enter each section line per line, by entering a section, hitting enter, then the next section, enter, and so on. when you done, type end.";
           cin >> stringa;
           end = stringc;
           if (end = end)
           {
                       cout<< "ok, you are now finished entering #'s\n\n";
                       }
                       else 
                       {           
                      cout << "\nNext:\n";
           cin >> stringb;
           end = stringc;
           if (end = end)
           {
                       cout<< "ok, you are now finished entering #'s\n\n";
                       }
                       else 
                       {           
                      cout << "\nNext:\n";
           cin >> stringc;
           end = stringc;
           if (end = end)
           {
                       cout<< "ok, you are now finished entering #'s\n\n";
                       }
                       else 
                       {           
                      cout << "\nNext:\n";
           cin >> stringd;
           }

I see the problem here. it's saying that if the string "end" equals itself, then go into the if statement. but what I want to happen is if someone actually types end, and hits enter, I want it to be able to know. if they type anything else, then just keep going. how do i do that?

Your IF statements are not testing for equality. You are assigning using just the single =.

Do this.

IF ( end == end )

blah, blah, blah

Is it a joke?
end == end is always true (if you don't overload operator ==, of course).
What's a sense of humor ;)...

=P

Just pointing out the incorrect use of = in the IF. But yes you are correct of course.

if (stringa == "end")

I think that's what you meant.

if (stringa == "end")

I think that's what you meant.

thanks. the "" was what i was missing. I used the ==, but it didnt work, so thats why i didnt place that in the code i showed you guys.

thanks. the "" was what i was missing. I used the ==, but it didnt work, so thats why i didnt place that in the code i showed you guys.

So basically, you where properly comparing an arbitrary word against itself?

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.