remarknibor wrote:
> I'm trying to create a structure that holds a number of word sets. 
> Each word set consists of the number of the set, a list of words in 
> the set, and the time a participant spends on the set:
> 
> struct wordsForSet {
>     int setNum;
>     string words[50];
>     float timeSpent;
> };
> 
> struct wordsForSet wordSets[6] = {
>     {0, "", 0.0},
>     {1, "", 0.0},
>     {2, "", 0.0},
>     {3, "", 0.0},
>     {4, "", 0.0},
>     {5, "", 0.0}
> };
> 
> This code compiled in Dev-C++, but I'm now moving to Visual C++ and 
> it's found errors with the code:
> 
> "error C2440: 'initializing' : cannot convert from 'double' 
> to 'std::string' 1> No constructor could take the source type, or 
> constructor overload resolution was ambiguous"
> 
> I guess it's something to do with initialising the string arrays, but 
> I don't know how to fix it.
> 
> Any suggestions would be much appreciated.
> 
> Thanks,
> 
> Robin.

The compiler is complaining about the initialization of the second 
parameter (apparently expecting all 50 entries to be filled in).  What 
VC++ compiler are you using?

Consider using vector<> (or Block<>) instead of declaring 50 'string's. 
  Also, the code seems poorly designed (you are using C++ templates but 
not classes to encapsulate functionality).

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to