// Update renderer and check for Qt events
void Update()
{
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	camera.Update();

	fluid.Update();

	CopyToFile();

//	glEnable(GL_DEPTH_TEST);
//	GLuint shaderProgramID = shaderManager.UseShader(SmokeShader);
//	raycaster.Raycast(shaderProgramID, camera, fluid.hostDensities, fluid.hostTemperatures);
//
//	glutSwapBuffers();

}
void main()
{
    int ch=0,ans=0;
    int val=0;
    char str[15];
    struct node *new1,*new2;


    clrscr();

    /* initialization of list with the existing records */

    fp=fopen("phone.txt","r");

    if(fp==NULL)
    {
        printf("File cant be opened !");
        getch();
        exit(1);
    }

    while(!feof(fp))
    {
        new1=getrecord();

        if(insert(new1)==-1)
            printf("Cant insert record ! Error...");
        else
            printf("Record entered...");
    }
    getch();
    fclose(fp);

    do
    {
        clrscr();
        printf("Menu");
        printf("1. Add a New phone record.");
        printf("2. Delete an existing Record.");
        printf("3. show all Records.");
        printf("4. Modify a particular Record.");
        printf("5. Exit.");
        printf("Enter your choice--->");
        scanf("%d",&ch);

        switch(ch)
        {
        case 1:

            new1 = getnode();
            val = insert(new1);
            if(val==-1)
                printf("Employee id already exists ! try again...");
            else
                printf("Employee details successfully stored");
            break;

        case 2:
            printf("Enter the phone no.you wish to delete--->");
            scanf("%d",&val);
            ans=delnode(val);

            if(ans==-1)
                printf("Record doesnt exist ! Try again...");
            if(ans==0)
                printf("Record deleted !");
            break;

        case 3:
            display();
            break;

        case 4:
            printf("Search by phone no. or Name ? (1/2)--->");
            scanf("%d",&ch);
            if(ch==1)
            {
                printf("Enter the phone no. you wish to search for--->");
                scanf("%d",&val);
                new2=query(val,&str,1);
            }
            else
            {
                printf("Enter the name of the person you wish to search for--->");
                scanf("%s",&str);
                new2=query(val,&str,0);
            }
            if(new2)
            {
                printf("Enter the New name of the person--->");
                scanf("%s",&new2->name);
                printf("Enter new phone no. of the person--->");
                scanf("%d",&new2->num);
                printf("Record modified successfully !");
            }
            break;
        case 5:
            printf("Leaving Database,writing back to file...");
            CopyToFile();
            getch();
            free(list);
            exit(1);
            break;
        }
        getch();
    }
    while(1);

}