I'm getting this complier error.Code:#include "stdafx.h" #include <iostream> #include <ctime> using namespace std; string randWord(); int main() { string guessWord = randWord(); //sets the returning value in guessWord cout << guessWord; //displays the random word return 0; } string randWord() { string wordBankArray[3] = {"random", "words", "here"}; srand(static_cast<int>(time(0))); int randWord = rand() % (2 + 1); return wordBankArray[randWord]; }
Code:1>------ Build started: Project: Hangman Project, Configuration: Debug Win32 ------ 1>Compiling... 1>Hangman Project.cpp 1>c:\documents and settings\angel\desktop\random\random project\random project.cpp(16) : error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)


Reply With Quote

Bookmarks