Linux C/C++ 作业辅导

c struct and linked list

CIS 342        Homework 2       Points 100           Due: May 4th, 2015.

 

GENERAL INSTRUCTION:

 

  • In this homework you are expected to code in C language using Struct and linked list in UNIX environment.
  • Compilation of the necessary files are to be done in a makefile which should resolve all dependencies between headers and C source codes

 

SPECIFIC REQUIREMENT:

 

  1. Create students: …………………………………………………………………………………………………. (25 points)

 

  • Create a Struct called Student with the following attributes in a file named Student.c

Name (String)

ID (int)

GPA (double)

 

  • Also in the Student.c file define functions
  • setName (char* name[size])
  • getName()
  • setID(int)
  • getID()
  • setGPA(double GPA)
  • getGPA()

cloud server c implemenetation

Project 5

CS 485 Project 5: A cloud server

Introduction

Over the past few years, the concept of a “cloud” where our programs and data can live has become very popular. What makes the cloud possible is a combination of Internet communication (enabling communication with servers located anywhere in the world) and virtualization of resources (enabling providers to offer/sell storage and computation inside the network). We are seeing companies race to put there services in the cloud, and users are rapidly embracing services in the cloud.

One of the most popular services is cloud file storage; the ability to upload your data to the cloud and then to download it whenever your need it to any device that needs it. Today we see an seemingly endless list of cloud storage providers (e.g., Amazon Cloud Drive, Google Drive, Apple ICloud, Box, DropBox, MS SkyDrive, SpiderOak, and others).

In this project, you will write your own cloud file storage service called mycloud<

CS100: Matrices solution

CS100: Matrices

Revision Date: April 16, 2015

Printable Version


Preamble

The purpose of this assignment is to give you some practice in creating and using matrices. We want to make sure students are comfortable with iteration and recursion involving matrices. In addition to the above we want to make it so students are familiar with reading in matrices from a file as well.

Task 0: Create your directories (10 points)

Create your directories with the commands

    cd
    cd cs100/labs
    mkdir lab7
    cd lab7
    mkdir month ascii maze

You should be able to just copy and paste these commands into your console. When finished you should have three directories under your lab7 directory called ascii, maze, and month.

Task 1: Generate a month for a calendar (30 points)

Move into dir

QEMU: Adding a System Call

Assignment 3 CMPT-300

QEMU: Adding a System Call

Disclaimer: This assignment is adapted from a project developed by Dr. Jason Nieh at

Columbia University.

Part A:

Setup Your Linux Kernel Building Environment and add dummy

syscall(25%):

The first step is to learn how to create a virtual machine using QEMU and install a

custom kernel.

Please follow this tutorial:

http://www.sfu.ca/~rws1/cmpt-300/assignments/a3-qemu-tut.pdf

All files can be downloaded from:

http://www.sfu.ca/~rws1/cmpt-300/assignments/cmpt300-a3.zip

Part B:

Adding an advanced system call(75%):

Write a new system call in Linux. The system call you write should take one argument

(pointer to a data structure) and return various information for the process identified by

the pid in the data structure. All return information will be put into the data structure. For

the following discussion all relative paths refer to the top of your kernel source

directory linux-2.6.26.5

The prototype for your system call will be:

int prinfo(struc

c++ virtual function 实现猜想

在C++中,最常见的多态指的是用基类指针指向一个派生类的实例,当用该指针调用一个基类中的虚函数时,实际调用的是派生类的函数实现,而不是基类函数。如果该指针指向另一个派生类实例,则调用另一个派生类的函数实现。因此,比如工厂模式返回一个实例,上层函数不需要知道实例来自哪个派生类,只需要用一个基类指针指向它,就可以直接获得需要的行为。从编译的角度来看,函数的调用地址并不是在编译阶段静态决定而是在运行阶段,动态地决定函数的调用地址。
多态是通过虚函数表实现的。当基类中用virtual关键字定义函数时,系统自动分配一个指针,指向该类的虚函数表。虚函数表中储存的是函数指针。在生成派生类的时候,会将派生类中对应的函数的地址写到虚函数表。之后,当利用基类指针调用函数时,先通过虚函数表指针找到对应的虚函数表,再通过表内储存的函数指针调用对应函数。由于函数指针指向派生类的实现,因此函数行为自然也就是派生类中定义的行为了。
Excerpt From: Yichao, Xiami, XiaoXiao & Fei Dong. “程序员面试白皮书.” iBooks. https://itun.es/us/zcOJ6.l

bmp manipulation

// ~ Overview ~ //

This exercise will familiarize you with structures, dynamic memory allocation, and
file operations.

// ~ Learning Goals ~ //

(1) To learn to read and write a structure into a file
(2) To learn to manipulate arrays

// ~ Submitting Your Assignment ~ //

You must submit one zip file to blackboard. This zip file must
contain:

(1) pe07.c
(2) bmp.c

You create the zip file using the following command.

> zip pe07.zip pe07.c bmp.c

// ~ Overview ~ //

The main purpose of this exercise is to familiarize you with
structures. It will also give you more practice with file operations
and memory allocation.

This exercise (and the next one) will gear you up for PA04, which
deals with an image format called BMP, which is commonly used in the Windows
operating system. Most web browsers are also able to read and display BMP files.
It is a modification of the exercise that Prof. Yung-Hsiang Lu gave to
his class.

In this exercise, you will read in a BMP file, and depending on the option
given, outpu

syr cis341 缓存区溢出漏洞利用实现

这个作业很刺激。。。

syr cis341 solution

Project 2: Buffer Overflow

1. Objective

Buffer overflows have been the most common form of security vulnerability in the

last ten years. Moreover, buffer overflow vulnerabilities dominate in the area of

remote network penetration vulnerabilities, where an anonymous Internet user seeks

to gain partial or total control of a host. These kinds of attacks enable anyone to take

total control of a host and thus represent one of the most serious security threats. [1]

Definition of buffer overflow from Wikipedia [2]: A buffer overflow, or buffer

overrun, is an anomaly where a program, while writing data to a buffer, overruns the

buffer’s boundary and overwrites adjacent memory. This is a special case of violation

of memory safety.

The goal of this lab is to get intimately familiar with the layout and use of data section,

code section and, particularly, call stacks, as well as MIPS machine language,

assembly and disassembly, debugging, and reverse engineering. As a side ben

若干c语言基础题目代写

c程序代做

1.6 – The Preprocessor

All exercises in this Level must be coded exclusively in C syntax (no

<iostream>, cout, cin, classes, etc.)

Exercise 1

Write a C-program that contains two print macro calls. The first prints the variable a, the

second prints the variables a and b. Printing happens by the use of the PRINT1 and

PRINT2 macros that accept arguments. These macros must be defined in an include-file.

The variables a and b gets their value in the function main().

Name the program “Macro.c” and the include-file “Defs.h”. Don’t forget to implement

the mechanism to avoid multiple inclusion of the header file.

Exercise 2

Create the two macros MAX2(x,y) and MAX3(x,y,z). These macros must return the

maximum value of the given arguments. Let the macro MAX3 make use of the macro

MAX2. Add these macros to the file “Defs.h”.

1.7 – Pointers and Arrays

Exercise 1

Try to create a function Swap(). This function must exchange the value of two variables.

For example: if i=123 and j=456, then i=456

c语言程序代写: Min/Max stack

CS 136 Assignment 10

Due Monday, April 6 at 11:59 AM sharp (noon).

Please read the preamble in Assignment 1.

Only the C language features introduced in this course are allowed.


In your code, you do NOT have to check that the value returned from malloc (or realloc) is invalid (NULL).

You may assume that all C strings are null terminated: you do not have to assert this.

If a requires statement specifies that a structure is “valid”, you may assume this, and you do not have to assert it.


Assignment 10 Problem 1. [15 Marks for correctness and efficiency.]

Write a C module mmstack.c that implements a Min/Max Stack ADT (MMStack) as described in mmstack.h.

We have provided a simple <

c语言程序代写: list, tree, binary search tree


Assignment 9 Problem 0. [2+2=4 Marks correctness]

Problem 0 is a “warm-up” question. You are allowed to collaborate with your fellow classmates and discuss the solution on piazza.

a) Complete the C program mylist.c to print the following: 10 9 8 7 6 5 4 3 2 1

b) Complete the C program mytree.c to print the following: 20 35 78

Note: No helper functions are allowed (for both parts a & b). You are supposed to build the list (in part a) or the BST tree (in part b) node by node. You are NOT allowed to change any implementation provided in mylist.c nor in mytree.c


Assignment 9 Problem 1. [36 Marks Correctness. File: list.c]

Goal: to practice implementing linked list in C

Write the C implementation list.c for the interface