Write a C++ program that emulate the operating system Solution #include using na
ID: 642156 • Letter: W
Question
Write a C++ program that emulate the operating system
Explanation / Answer
#include using namespace std; struct node{ int number; int count; string name; node * next; }; class LinkedList{ //creating linked list and calling functions private: node * head; public: LinkedList(){ head = NULL; } void createMemory(); void print(); void insertion(int numb, int numbPages); void removal(int number, int numbPages); int counter(); }; void LinkedList::createMemory(){ //make 32 free nodes head = new node; node * temp = head; for(int i = 0; i < 32; i++){ temp->name = "FREE"; temp->next = new node; temp = temp->next; } temp->next = NULL; } void LinkedList::print(){ //print out 32 free nodes to start node * temp = head; string t; for(int i = 0; i < 32; i++){ t = temp->name; cout programSize; if(programSize % 4 == 0){ //if progarm size is divisible by 4 then add that many pages numbPages = programSize / 4; } else{ numbPages = (programSize / 4) + 1; //if program size is not divisible by 4 then round up to create whole pages } FREE.insertion(number, numbPages); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.