I am trying to split a single string, with spaces, into three separate strings. For example, I have one string (str1). The user inputs any 3 words such as  "Hey it's me" or "It's hot out".  From there, I need to write a function that will take this string (str1) and divide it up into three different strings. So that (taking the first example) it will then say:  Hey (is the first part of the string) it's (is the second part of the string) me (is the third part of the string)   I'm having difficulty which manipulation I should be using to split the string at the spaces.   This is the code I have so far, which is just how the user will enter input.I am looking for the most basic way to accomplish this WITHOUT using istringstream! Using only basic string manipulation such as find(), substr().   ** I am looking to create a separate function to perform the breaking up of string ** I figured out how to get the first section of input with this code:   cout &lt;&lt; "Enter a string" &lt;&lt; endl; getline(cin, one);  position = str1.find(' ', position); first_section = str1.substr(0, position);   But now I have no idea how to get the second section or the third section of the string to be divided up into their own string. I was thinking a for loop maybe?? Not sure.    #include &lt;iostream&gt; #include &lt;string&gt; using namespace std;  int main() {    string str1;    cout &lt;&lt; "Enter three words: ";    getline(cin, str1);    while(cin) {         cout &lt;&lt; "Original string: " &lt;&lt; str1 &lt;&lt; endl;         cin &gt;&gt; str1;    }     return; }
I'm trying to iterate over the words of a string.  The string can be assumed to be composed of words separated by whitespace.  Note that I'm not interested in C string functions or that kind of character manipulation/access. Also, please give precedence to elegance over efficiency in your answer.  The best solution I have right now is:  #include &lt;iostream&gt; #include &lt;sstream&gt; #include &lt;string&gt;  using namespace std;  int main() {     string s = "Somewhere down the road";     istringstream iss(s);      do     {         string subs;         iss &gt;&gt; subs;         cout &lt;&lt; "Substring: " &lt;&lt; subs &lt;&lt; endl;     } while (iss); }   Is there a more elegant way to do this?
Texture mapping with multiple UV maps So, as a newbie relatively new to blender, I started doing some texture mapping (blender internal Render). I created a texture for the main object and a couple of transparent decals to decorate it. (basic effects made in GIMP). Simple stuff, just to know how it works.  After unwrapping, having 2 UV maps made, creating both new material and textures, enabling UV mapping coordination I always end up with:  - all - 1 faces of the cube being covered nicely in the main texture  - 1 face covered in blank material with a decal in the middle of it  - the whole thing partly coated by a huge "stain" of a decal  So, the problem is that I can't layer textures correctly. Is there a way to have one texture covering everything and more transparent ones on top of it? I am working on a bigger project right now and having this ability would be useful How to call a constructor on an already allocated memory? How can I call a constructor on a memory region that is already allocated? Why is paper more frangible when it is wet? My four-year-old daughter asked me why paper tends to fall apart when wet, and I wasn't sure.  I speculated that the water lubricates the paper fibers so that they can untangle and separate more easily, but I really wasn't sure. Hat duplicates when info is expanded How does "proof of effort" make a question better? It seems like many questions by new users are downvoted immediately.  Sometimes there is a comment to the tune of "lacks research", "we're not here to do your homework", or "show us some effort".  Now I wonder, what does it matter how much work someone has done before posting?  If someone can ask a good question in 5 seconds, more power to them.  To illustrate this point, look at how you could "improve" a question to include proof of effort.  You could put in 5 failed code snippets and their in- and output.  This would make for very long questions with a high noise ratio.  Another suggestion is to add "research".  By "research", I suppose most programmers mean "Google".  So this is basically a suggestion to add a list of fruitless Google queries.  That doesn't sound interesting either.  How can "proof of effort" turn a bad question into a good one? Can "cattle" be singular? I've grown up on a farm, and my dad and his dad, apparently, always used "cattle" to refer to both the singular and plural forms of the domestic bovine. I've always assumed it's how the word "deer" is.  However, I've heard people say that this is incorrect and the singular is just "cow", but this has always offended us as a cow is a mother cattle, and is incorrect if you're referring to a steer, a bull, or a heifer.  So, is cattle singular as well as plural? If not, is there some general, non-gender-specific word that should be used instead? Is there any "superlogarithm" or something to solve $x^x$? Is there any "superlogarithm" or something to solve an equation like this:  $$x^x = 10?$$ Floor function in complex plane My question is very simple. How would one take the floor of a complex number and what is the floor of i? A little look through an etymology dictionary shows that the root is Latin gigas with adjective form gigant.  So in its derivation to English, why did the second "g" get retained in gigantic but was dropped from giant?  I have an inkling that the word giant may have travelled through French on its way to English, where it may have been pronounced "gee-yant" or "jee-yant" with a change to the second "g" that was then dropped when taken into English.  However, the "g" is retained as a hard "g" in gigantic. Can "what kind" be plural? Is it correct to say, "What kind of patents are being issued in these sophisticated times?" It seems like it should be What kind of patents is being issued..., but that sounds wrong.  What kind of patent is being issued... is correct and sounds right, but loses a little bit of the original meaning.  Is there something magic about what kind that allows it to be plural, or do people just misuse it a lot? Submitting a form by pressing enter without a submit button Well I am trying to submit a form by pressing enter but not displaying a submit button. I don't want to get into JavaScript if possible since I want everything to work on all browsers (the only JS way I know is with events).  Right now the form looks like this:  &lt;form name="loginBox" target="#here" method="post"&gt;     &lt;input name="username" type="text" /&gt;&lt;br /&gt;     &lt;input name="password" type="password" /&gt;     &lt;input type="submit" style="height: 0px; width: 0px; border: none; padding: 0px;" hidefocus="true" /&gt; &lt;/form&gt;   Which works pretty well. The submit button works when the user presses enter, and the button doesn't show in Firefox, IE, Safari, Opera and Chrome. However, I still don't like the solution since it is hard to know whether it will work on all platforms with all browsers.  Can anyone suggest a better method? Or is this about as good as it gets? How can I disable javascript popups/alerts in Chrome? Sorry if it's been asked. I've already found several solutions that aren't working. Not sure what I'm doing wrong.   I don't want to disable all javascript, only Javascript alert boxes. The ones that pop up and force you to click OK or X to close them.  I've found user scripts that claim to do this (example:  ). I've put chrome on the dev channel, start chrome with the --enable-user-scripts switch, the script shows up as installed.  But I still get the alert boxes.  An example alert box that isn't getting disabled is at  - put in any garbage word into the word validator on the right sidebar. You get a popup telling you it's not a word. How can I tell if sheet a exists in a workbook? I have the following code that's not working as expected:  If Sheets("a") &lt;&gt; "" Then MsgBox ("sheet a exists")   How can I tell if sheet a exists in the workbook? Why did Palpatine wait so long before giving Order 66? Given a compact set $K$ and closed set $E,$ prove: $E\cap K\neq \emptyset $ Let $K\subseteq \mathbb{R}^n$ be a compact set and $E\subseteq \mathbb{R}^n$ a closed set, such that: $$\inf\{d(x,y):x\in K, y\in E\}=0$$ where $d(x,y)=\sqrt{\sum_j(x_j-y_j)^2}$ Prove: $E\cap K\neq \emptyset $  I tried to work with the definitions of compact and closed sets, and I understand that from what's given of the distance between elements in $K$ and $E$, that they are very close,  but couldn't really get further. Any help appreciated. What does linear time series refer to? In some papers or documents, "linear times series" seems to refer to a time series that can be modeled as a linear AR (auto-regressive) model.   In other places, "linear time series" seems to refer to a time series with a linear trend.   When someone just drops "linear time series" out of the blue without any context, what do they mean usually? Reputation changes not visible in the achievement box (again) Just like , which was marked as . But today, it's not working again. I'm still notified of new badges:      Update: it looks like new events are now updated; reputation events from earlier this UTC afternoon are still missing: Postgres JDBC connection in Eclipse Help I'm trying to get a postgres jdbc connection working in eclipse. It would be nice to use the Data Source Explorer, but for now I'm just trying to get a basic connection. What I have done so far is download the postgres JDBC connector. I then tried two different things. First, Preferences-> Data Management, I tried to add the postgres connector. Second, I added the jar to my project and tried to load the driver using Class.forName("org.postgresql.Driver"); but neither worked. Does anyone have any ideas?  Thanks,    Charlie Age of universe? Well relativity teaches us that time interval between two events is a frame dependent quantity, then how can we say that our universe is 13.8 billion years old? Should it not depend on who is asking this question? Vertical space in lists