How do I do this? And can I do that? (about checking string content and file output)
Okay, once again I am in need of some help. Nothing critical, but I'm trying to puzzle together small programs to make my life easier :P. Any help or comment would be very much appreciated :).
Okay, the first thing:
I'm building up a code to repeat one long, relatively simple process:
Ask for a multitude of information, store it and output it into a file.
Now, I can write the numerous cout and cin lines myself, that's hardly the problem. But, at some point, I need to check the string that was entered with cin for a certain value (It needs to detect whether B is in the string, whether E is in the string and whether FB is in the string. If I know how to do that, I can easily tell it to add 1 to the variables B_Counter, E_Counter and FB_Counter or something, to be used later on.).
I need to know, how can I do this efficiently?
cout would output the following to the screen: "Please enter the components:"
via cin I would then enter: B, C, F, V, S
That input should be stored as the string Components.
Now, I just need to check this string for whether B is present or not (or really any string I would enter). How do I do that?
If this answer is in a tutorial or something, and I just haven't read it carefully enough, it'd be fine to just direct me to the URL so I can read it :).
My second question would be:
Is there a way to get my program (in C++, obviously) to make a .doc (or .rtf) file? And, by that, I mean, can I also put bold, italics etc. into that directly from the program?
Or is that just a matter of knowing the code word/wordpad uses to create these styles (for example, <b>bold</b>) and implementing this into the code?
for example: If I wanted my file to accept input with cin, and the input would be 'Monkeys', is there a way to automatically have this be transferred to a file as bold, or should I just have my program add <b> before it and </b> after it to produce Monkeys?
Would <b> and </b> even work? (assuming that's the correct code for word...) or should I save it with <b> and </b> to a txt file and then convert it to Word?
Or is it not possible at all?
Thank you so much for any help or insight you might be able to offer. It helps me a lot :).