jenritz2k3
03-22-09, 07:11
may i ask for a sample program for a fifo problem? in c++ is any body has?
it is like an array? or does any body can help me figure out what is missing in my program?
here is the program pls help me figure out what is missing? thanks in advance..
#include <iostream.h>
#include<conio.h>
#include<string.h>
int ctr, sw=0, op, res;
char job[4], mm[10][4];
void main()
{ clrscr(); //intialize memory
for(ctr=0;ctr<10;ctr++)
strcpy(mm[ctr],"---");
while(op<4)
{
clrscr();
//display memory
for(ctr=0;ctr<10;ctr++)
{
gotoxy(5,ctr+4);
cout<<mm[ctr];
}
//options for memory management
gotoxy(1,15);
cout<<"OPTIONS";
gotoxy(1,17);
cout<<"1. ALLOCATION";
gotoxy(1,18);
cout<<"2. DEALLOCATION";
gotoxy(1,19);
cout<<"3. COMPACTION";
gotoxy(1,20);
cout<<"4. EXIT";
gotoxy(1,20);
cout<<"CHOICE:";
//enter choices[1-4] and place it to a variable op
gotoxy(10,22);
cin>>op;
switch(op)
{
case 1:
//initialize switch to 0 which signifies that memory is not yet full.
sw=0;
//test if the memory if already full
for (ctr=0; ctr<10;ctr++)
{ res=strcmp(mm[ctr],"---");
if(res==0)
{
gotoxy(1,24);
cout<<"ENTER JOB NAME :";
gotoxy(18,24);
cin>>job;
//how to input exlusivity here?
//exlusivity is the term use when two similar jobs are not allowed to be
//in the memory at the same time.
strcpy(mm[ctr],job);
// assign 1 as switch value after allocating the incoming job
sw=1;
break;
}
}
if(sw==0)
{
cout<<"MEMORY FULL!"
getch();
}
case 2: //how to input deallocation?
//is the process of freeing a memory location
break;
case 3:
//how to input compaction in c++
//compaction is the process of all occupied areas to
//one end or the other of the main storage.
break;
}
}
}
plsss. any idea c++ masters..??? thanks in advance.
it is like an array? or does any body can help me figure out what is missing in my program?
here is the program pls help me figure out what is missing? thanks in advance..
#include <iostream.h>
#include<conio.h>
#include<string.h>
int ctr, sw=0, op, res;
char job[4], mm[10][4];
void main()
{ clrscr(); //intialize memory
for(ctr=0;ctr<10;ctr++)
strcpy(mm[ctr],"---");
while(op<4)
{
clrscr();
//display memory
for(ctr=0;ctr<10;ctr++)
{
gotoxy(5,ctr+4);
cout<<mm[ctr];
}
//options for memory management
gotoxy(1,15);
cout<<"OPTIONS";
gotoxy(1,17);
cout<<"1. ALLOCATION";
gotoxy(1,18);
cout<<"2. DEALLOCATION";
gotoxy(1,19);
cout<<"3. COMPACTION";
gotoxy(1,20);
cout<<"4. EXIT";
gotoxy(1,20);
cout<<"CHOICE:";
//enter choices[1-4] and place it to a variable op
gotoxy(10,22);
cin>>op;
switch(op)
{
case 1:
//initialize switch to 0 which signifies that memory is not yet full.
sw=0;
//test if the memory if already full
for (ctr=0; ctr<10;ctr++)
{ res=strcmp(mm[ctr],"---");
if(res==0)
{
gotoxy(1,24);
cout<<"ENTER JOB NAME :";
gotoxy(18,24);
cin>>job;
//how to input exlusivity here?
//exlusivity is the term use when two similar jobs are not allowed to be
//in the memory at the same time.
strcpy(mm[ctr],job);
// assign 1 as switch value after allocating the incoming job
sw=1;
break;
}
}
if(sw==0)
{
cout<<"MEMORY FULL!"
getch();
}
case 2: //how to input deallocation?
//is the process of freeing a memory location
break;
case 3:
//how to input compaction in c++
//compaction is the process of all occupied areas to
//one end or the other of the main storage.
break;
}
}
}
plsss. any idea c++ masters..??? thanks in advance.