string program

Pages: 12
The following still runs, compiles and otherwise program runs correctly.

I edited the code to the following due to the program needing to break if "stop" was entered thus in a different string.


1
2
3
4
5
6
7
8
9
10
11
12
string stop[] = { "Stop" };

......
......


if (!flavor_input.compare(stop[0]))
		{
			break; 

			valid_option = false; 
		}



Due to it functioning, is that alright or do I need to do it differently?

That's technically ok, but it would be easier to write: if(!flavor_input.compare("Stop")) :)
I changed it to how you had, for it is as you said and much easier. I am still trying to learn the simple shortcuts and other things that come with time and experience. This is my first class so I'm just starting out.


Thank you very much for your patience and all the assistance you have provided. Due to how the professor set up the assignment and due dates along with that test, I wasn't sure if I could get it all. I now know that I wouldn't have and I thank you for assisting.



For others who scroll through the thread, the program is complete to all directions and is running.
I'm still a begginner too and i'm glad I could help. At least you have learned something from this. All I can say is stick around here and you will learn a lot. There are some members on here that really know what they're talking about, and you won't find better answers anywhere.

On a different note, if its not too much bother for you, could you send me your next assignment as a private message please? Its easier to do something someone else has set than it is to come up with somehting yourself lol.
As in, what I would normally post in the first post of a thread?

If that is the case, that would be great if you are willing to help. The instructor didn't say that we would definitely have another assignment this semester b/c we don't have that many more chapters to cover, but it wouldn't surprise me if he came up with something that would be a cumulative assignment from everything we've learned. I will send the details as a PM if we do get something (probable).

I'm going to let the holiday pass and then when settled back in I need to complete a Java program I started that's due the 13th of December. I have a majority of it completed but need to finish it off.

Thanks again for all your assistance. Hope you have a great holiday.
Topic archived. No new replies allowed.
Pages: 12