0

I want to get this string arrays and turn them into double arrays, but i get this :

#include <sstream>
	#include <cstdlib>
	#include <iostream>
	#include <string>
	using namespace std;
	int main ()
	{  string str[3]={"2.5","3","1.5"};
	    istringstream stm;
	     
	     
	    double d[3];
	    for(int i=0;i<3;i++)
	 
	    {stm.str[i];
	    stm >>d[i]; 
	    cout << d[i] << endl;  }
	  
	         
	    return 0;
	}

1>------ Build started: Project: strTod, Configuration: Debug Win32 ------
1>Compiling...
1>Std.cpp
1>c:\users\user\documents\visual studio 2008\projects\strtod\strtod\std.cpp(14) : error C3867: 'std::basic_istringstream<_Elem,_Traits,_Alloc>::str': function call missing argument list; use '&std::basic_istringstream<_Elem,_Traits,_Alloc>::str' to create a pointer to member
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Alloc=std::allocator<char>
1> ]
1>c:\users\user\documents\visual studio 2008\projects\strtod\strtod\std.cpp(14) : error C2109: subscript requires array or pointer type
1>Build log was saved at "file://c:\Users\User\Documents\Visual Studio 2008\Projects\strTod\strTod\Debug\BuildLog.htm"
1>strTod - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by arkoenig
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.