Пример #1
0
void main()
{
	clrscr();
	cout << "Enter the Number of Process : ";
	cin >> n;

	cout << "\n\n1) FCFS   2) SJF   3) SRTF   4) RR\n\n";
	cout << "Enter Your Choice : ";
	cin >> choice;

	cout << "\n";
	int i;
	for(i=0;i<n;i++)
	{
	cout << "Arrival Time & Service Time for Process " << i+1 << " : ";
	tab[i][0]=i+1;
	cin >> tab[i][1];
	cin >> tab[i][2];
	}
	ttt=totaltime();
	switch(choice)
	{
		case '1': fcfs();break;
		case '2': sjf();break;
		case '3': srtf();break;
		case '4': rr();break;
		default : exit(0);
	}

}
int EDFfilehandler::closefile(){
if (f){
    char str[256];
    if (addannotationtime && numofdatarecords>0){
        char found=0;
        int acount=1;
        while (getannotation(0,acount++,str))
            if (strncmp(str,ttstr,strlen(ttstr))==0){
                found=1;
                break;
            }
        if (!found){
            sprintf(str,"%s%+.3f",ttstr,totaltime());
            addannotation(0,str);
        }
    }
    fseek(f,8,SEEK_SET);
    writefilestr(patientid,80);// patient name
    writefilestr(recordid,80);//recording id
    writefilestr(startdaterec,8);
    writefilestr(starttimerec,8);
    fseek(f,236,SEEK_SET);
    sprintf(str,"%ld",numofdatarecords);
    writefilestr(str,8);// num of data records
    fclose(f);
    f=NULL;
    //qDebug()<<"edfhcalled file closed";
    }
//.... buffers?
}