intellisensor not recognizing my string data type.

So Im working on my semester prject for my programming class. It is to make a roulette game. And Im working on getting my table set up but the intellisensor in my Visual Studio seems to not be working and recognizing the string variable type. Its not changing to blue when I enter it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//Justin Wright
//COSC 1430
//This program is a roulette simulation, designed to be used for online gambling.

#include <iostream>
#include <iomanip>
#include <Windows.h>
#include <string>
#include <ctime>
using namespace std;


//Function Prototypes
void welcome();
double getBalance();
void displayTable();
void rouletteTableFunction();

int main()
{
	//Variable Declarations
	int winningNumber = 0;
	double balance = 0;
	double bet = 0;
	


	//Random Number Seed
	srand(static_cast<int>(time(0)));
	winningNumber = 0 + rand() % (36 - 0 + 1);

	cout << fixed << setprecision(2);

	welcome ();
	system ("Pause");

	system("CLS");

	balance = getBalance();
	system ("Pause");

	system("CLS");

	displayTable();



	system ("pause");
	return 0;
}

//Welcome Screen Function
void welcome()
{
	cout << ("       \n");
    cout << ("*******  ******   *      *  *      *****  ******* *******  *****        \n");
	Sleep(500);
    cout << ("*     * *      *  *      *  *      *         *       *     *        \n");
	Sleep(500);
    cout << ("******* *      *  *      *  *      *         *       *     *        \n");
	Sleep(500);
    cout << ("*   *   *      *  *      *  *      *****     *       *     *****        \n");
	Sleep(500);
    cout << ("*    *  *      *  *      *  *      *         *       *     *        \n");
	Sleep(500);
    cout << ("*     *  ******    ******   ****** *****     *       *     *****        ");
    cout << ("                           ");
}

double getBalance()
{
	double balance = 0.0;

	cout << "Welcome to the table champ." << endl << "Please enter the amount of cash you wish to play with:$";
	cin >> balance;
	cout << endl << "Your balance is: $" << balance << endl;
	return balance;
}

void displayTable()
{	

	string rouletteTable [2][18] = 
	{{"1", "3", "5", "7", "9", "12", "14", "16", "18", "19", "21", "23", "25", "27", "30", "32", "34", "36"},
	{"2", "4", "6", "8", "10", "11", "13", "15", "17", "20", "22", "24", "26", "28", "29", "31", "33", "35"}};
	

	int row = 0;
	int column = 0;

	while (column <= 1)
	{
		while (row <= 17)
		{
			cout << rouletteTable[row][column] << endl;
			row +=1;
		}//end while
		column +=1;
		row = 0;
	}//end while 


I have no idea what to do. When I run the program it gives me an error as well sometimes. This one: Unhandled exception at 0x0f681f68 (msvcp100d.dll) in Roulette Final Project.exe: 0xC0000005: Access violation reading location 0x8bb59d35.

Which opens another tab named "iosfwd" and points to this bit of code:

1
2
3
4
static int_type __CLRCALL_OR_CDECL to_int_type(const _Elem& _Ch)
		{	// convert character to metacharacter
		return ((unsigned char)_Ch);
		}


Can anyone help me???
Visual Studio colors keywords blue. string is not a keyword in C++.

The crash is likely due to displayTable(). The loop accesses rouletteTable incorrectly.
Alright, thanks. But that doesnt tell me how to fix it
That's right. I've told you where the problem is and what it is. You should be able to fix it on your own.
I have no idea HOW the loop is accessing rouletteTable incorrectly though. I spent hours last night with a friend of mine trying to fix the issue and havent been able to.
Hint: Your program is trapping on line 95. Which subscript is for rows and which is for columns?
Topic archived. No new replies allowed.