Skip to content

Instantly share code, notes, and snippets.

#include<stdio.h>
#include<stdlib.h>
//Assume that a system has a 32-bit virtual address with a 4-KB page size.
//Write a C program that is passed a virtual address (in decimal) on the command line
//and have it output the page number and offset for the given address.
int main(int argc, char *argv[])
{
unsigned long page_number;
@pythongo1
pythongo1 / hw8.cpp
Last active June 22, 2019 12:25
hw8.cpp
#include<stdio.h>
#include<stdlib.h>
//Assume that a system has a 32-bit virtual address with a 4-KB page size.
//Write a C program that is passed a virtual address (in decimal) on the command line
//and have it output the page number and offset for the given address.
int main(int argc, char *argv[])
{
unsigned long page_number;
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
//Write a program that implements the FIFO and LRU page-replacement algorithms presented in this chapter.
//First, generate a random pagereference string where page numbers range from 0 to 9.
//Apply the random page-reference string to each algorithm, and record the number of page faults incurred by each algorithm.
//Implement the replacement algorithms so that the number of page frames can vary from 1 to 7.
//Assume that demand paging is used.
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<tchar.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
//template<typename T,size_t N>
//template<size_t N>
//void catalan(int (&ans)[], int size)
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<tchar.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
//template<typename T,size_t N>
//template<size_t N>
//void catalan(int (&ans)[], int size)
#include <windows.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#pragma comment(lib, "user32.lib")
int main()
{
workspace_folder/ -- WORKSPACE
src/ -- SOURCE SPACE
CMakeLists.txt -- 'Toplevel' CMake file, provided by catkin
package_1/
CMakeLists.txt -- CMakeLists.txt file for package_1
package.xml -- Package manifest for package_1
...
package_n/
CMakeLists.txt -- CMakeLists.txt file for package_n
package.xml -- Package manifest for package_n
<launch>
<group ns="turtlesim1">
<node pkg="turtlesim" name="sim" type="turtlesim_node"/>
</group>
<group ns="turtlesim2">
<node pkg="turtlesim" name="sim" type="turtlesim_node"/>
</group>
#include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>
/**
* This tutorial demonstrates simple sending of messages over the ROS system.
*/
int main(int argc, char **argv)
{
#include "ros/ros.h"
#include "std_msgs/String.h"
/**
* This tutorial demonstrates simple receipt of messages over the ROS system.
*/
void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str());
}