Hello, I am asp.net C# developer. I decided to tackle C++, so I started today. This is probably something simple I am sure but I cannot figure out what the problem is. I would appreciate if someone could show me what is wrong and why.
The error is happening on the last output operator, just before the jumble variable on the last line.The error is:Code:srand(static_cast<unsigned int>(time(0))); int choice = rand() % NUM_WORDS; string theWord = WORDS[choice][WORD]; string theHint = WORDS[choice][HINT]; string jumble = theWord; int length = jumble.size(); for(int i = 0; i < length;i++) { int index1 = (rand() % length); int index2 = (rand() % length); char temp = jumble[index1]; jumble[index1] = jumble[index2]; jumble[index2] = temp; } cout << "\t\t\tWelcome to Word Jumble!\n\n"; cout << "Unscramble the letters to make a word.\n"; cout << "Enter 'hint' for a hint.\n"; cout << "Enter 'quit' to quit the game.\n\n"; cout << "The jumble is: " << jumble;
I understand what its saying, but jumble is a std::stringCode:Intellisense: no operator"<<" matches these operands operand types are: std::basic_ostream<char, std::char_traits<char> <<std::string
Here are my preprocessor directives and using statements
Thanks in advance!Code:#include "stdafx.h" #include <iostream> #include <ctime> #include <cstdlib> using namespace std;


Reply With Quote
Bookmarks