bug

cant figure out whats wrong with it it just wont compile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# include <iostream>
# include <string.h>

using namespace std;

int main()
{
	string spare;
	cout << "menu" << endl;
	cout << "start" << endl;
	cout << "exit" << endl;
	cin >> spare;
	if (spare == "exit") return 0;

}
Instead of <string.h> (C char array handling functions) try including <string> (C++ string class)
thanks its always worked with .h though strange that that fixed it
thanks its always worked with .h though strange that that fixed it


What was probably happening was that <iostream> was #including <string> without you realizing it. Which is why it may have worked before but not now.
Topic archived. No new replies allowed.