I'm not sure this is really a windows programming question, it might fit better in beginners section.
I'm also not sure how to use std::istringstream but I would do something like this with my beginner knowledge.
*Basically read the character from the string.
*Cast the character to an int
*Subtract 48 because that's where the ascii 0 starts.
*Multiply by 10^i for it's place in the number string
*then add the result to the total.
I think the GCC version for linux and the GCC version for windows (called mingw) is different.
I don't think Mingw has official development or versioning so it's hard to tell if you are using the latest version. Although it has been about a month since I updated my mingw so I could give that a shot I suppose.
For mingw I don't think there is any versioning numbers. You can't find a version number on the downloads from mingw.org. I can't find a version number anywhere on my install. Everything I've read on the mingw faq says mingw is based on specific versions of other linux programs but not that it is the same (nor would it make sense for it to be the same because they are different operating systems.)
If you run g++ --version and it displays an error or nothing at all then you dont have it installed correctly. I am able to run stoi fine on the latest mingw. And gcc and mingw arent that much different considering mingw is a port of gcc to windows.
I was also wondering,
How would I have the user input a function name and an argument ( insert 56 ) but also be able to input just print or a single function with no argument and be able to call the function ?
Such as
Input:
insert 56
then run the insert command
Input:
print
then run the print command
I just dont know how I can have input with one or the other. Because cin>>function>>argument
will require an argument input so if I just wanted to run print I would have to input a second argument.
Any ideas?
Hmm. I don't have it installed incorrectly and I would point out that this isn't an issue that only I have had.
I'm not posting this to argue with Joshua Schweigert or anybody else but rather to provide information to anybody else who might view this thread. Although I would point out that it isn't exactly helpful to say "It works for me so it must work for everybody". At least provide information on which version you are using or where you downloaded your version if you are trying to help.
Here is what I've found by searching; if you want to use STOI, STOL, etc you must use the latest unreleased version of mingw version 4.8.1. At least I think it's unreleased as I can't find any version numbers of anything on mingw.org
There isn't even a mention of where to find latest builds or anything else for that matter.
I almost wonder if mingw.org is the official mingw site because it doesn't appear to ever get updated.
This site appears more helpful and I'll give this version a shot. Although I only see version 4.8.0 on there and not 4.8.1
As I said in my previous post I installed the latest version from the download link on mingw.org. So whichever that version is thats what I'm running and stoi runs perfectly fine on it.
You never said where you got your version of mingw from. I see mingw version 4.7.2 download links off the mingw.org site after searching around the site for a while.
That site could be better organized to make information easier to find.
TL/DR thread.
If you are having trouble finding a version of mingw to run STOI / STOL get the nuwen mingw version off this site.