string does not name a type
| icemanfan (17) | |||
| My code: #include <iostream> #include <string.h> using namespace std; class Menu { private: String choices[5]; String title; public: int Select(); }; int Menu::Select() { int i; int selection = 0; for (i = 0; i < 5; i++) { cout << (i+1) << ": " << choices[i] << endl; } while (selection < 1 || selection > 5) { cout << "Enter selection: "; cin >> selection; } return (selection - 1); } int main() { return 0; } When I try to compile this I get the error message "String does not name a type." Also, I get the message "'Choices' was not declared in this scope." I don't understand why I am getting either of these errors. | |||
| Zaita (812) | |||
#include <string> not
#include <string.h> | |||
| icemanfan (17) | |||
| I tried changing #include <string.h> to #include <string> but I still get the same error messages. | |||
| InLight (38) | |||
| The string type is "string" not "String" | |||
| icemanfan (17) | |||
| thanks, that was simple | |||
This topic is archived - New replies not allowed.
