辅导案例-207SE

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
207SE Lab 1 (Wk Commencing 6
th
October 2014)

Your task

a) In one paragraph explain the modified Harvard architecture. You might include diagrams and
compare it with the von Neumann architecture and the Harvard architecture.

b) Complete either activity b1 or b2 below. (Do not do both!!)

Evidence

The paragraph on modified Harvard architecture, and commented source code with output examples for either
activity b1 or b2.

Activity b1

Write a simple program (or adapt the C++ program in Appendix A) to parse a string to determine if it fulfils one
of the following grammar order rules. Below are rules related to the basic grammar. For example in
the grammar, an is followed by an and the is follow by a
.

Grammar rules

Correct sentence structure =
Correct sentence structure =
Correct sentence structure =
Correct sentence structure =
Correct sentence structure =

Words marking up vocabulary
Agent Word:- bot
mike

Action words:- pick
put
lift
drop
go

Direction word:- forward
backwards
left
right


Pronoun word:- I
you
we

Objects words:- nuts
plum
cat
cup

Colour words:- red
blue

Examples of grammatically correct and incorrect inputs

bot pick plum  We drop cup 
I go nut  bot lift left 
bot pick plum plum  drop cup 
nut go left  left left left 



Appendix A

//This C++ code is used to take an input string and put words in an array
#include
#include
#include
using namespace std;

int main() {
//set up input string
string input="bot pick ball";
//initalise input stream
stringstream currentstring(input);
int count=-1;
string word[10];
//Repeatedly put words in string array
while (currentstring.good()) {
count=count+1;
currentstring >> word[count];
}
return 0;
}

To compile and run C++ in eadwine use

1. Save file with a .cc extension
2. Type g++ -o parser string.cc at the command prompt
3. Type ./parser at the command prompt

Activity b2

Write a simple program in at least three (3) programming languages. It should display your full name
broken into blocks. The length of the block should be equal to the first digit in your university user id. If
your name is so unique it has no digit, use the LAST digit of your student ID. Each block should be on a
new line. For example if Graeme Stewarts’ id is ab247 the output would be.

Gr
am
e
St
ew
ar
t

51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468