Can't generate student id

Ladies and gents,

I'm working on a simple database, and I'm trying to make it so that a student id is generated and then not approved till unique when adding a new record. So far, all I'm getting is the Windows error number...3435973836.

I also have a value for the index if that will help any

Please HELP!

Here's the code I'm using:
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
{
   bool status;
   bool done = false;

	if (storage.size() == 0)
	{   index = 0;
       	storage.push_back(myRecord); //first record = 0 location
	msg = "Record successfully added!";
	status = true;
	done = true;
	}

	//checking to see if id field has duplicate

	if (!done)
  //entering a student ID
	{unsigned int i;	
	myRecord.idField = storage[i].idField + 1; //<---where I'm trying to add id number
	for (i = 0; i < storage.size() && (myRecord.idField > storage[i].idField); ++i)        
	if (i < storage.size() && myRecord.idField == storage[i].idField)
		{
			done = true;
			status = false;
			msg = "Record already exists!";
		}
		else
		{
			done = false;
		}
	}
You need to initialize i on line 17.
Topic archived. No new replies allowed.