联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2018-11-26 10:52

Bonus Assignment

Assignment 6

CISC 220, Fall 2018

Administrative Notes:

This assignment is a bonus assignment. You will not lose marks toward the 100 marks of the

course if you do not do it. Conversely, if you do it correct, you will gain as much as any other

assignment weight in top of what you get out of the 100 total marks of the course marking.

All of the administrative notes from previous assignments apply to this assignment as well. I will

just summarize the main points here and you can refer back to the previous assignments

instructions for more details:

Your program should work in CASLab Linux servers.

No group work allowed.

Hand in your file to OnQ in the “Assignment 6” Dropbox area.

Follow instructions carefully or you may lose points.

There is no “grace period” for this assignment as you will be given ten days to finish it.

Deadline:

The deadline for this assignment is Monday, November 26 at 8 a.m.

Required Program:

This is your IO assignment and your task is to write a C program as explained. It can be done

with the features of C we've discussed in the “Input/Output” topic in class. The required program

should be able to read from a text file and breaks the given text into lines on maximum 20

characters.

Each line should hold the maximum number of complete words it could get. The start of the next

line is activated only when the program gets a word that doesn’t fit in the remaining space of the

current line.

For example:

If the given text file contains the following text in one line. A quote from William Shakespeare:

Love all, trust a few, do wrong to none. A fool thinks himself to be wise, but a wise man …

Assume that the maximum number of character a line can hold is 10 then, the sentence will be

broken into the following lines

Char No. 1 2 3 4 5 6 7 8 9 10

Line 1 L o v e a l l ,

Line 2 t r u s t a

Line 3 f e w , d o

Assume that the maximum number of character a line can hold is 15 then, the sentence will be

broken into the following lines

Char No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Line 1 L o v e a l l , t r u s t

Line 2 a f e w , d o w r o n g

Line 3 t o n o n e a f o o l

The program output doesn’t have to be included in boxes like this. They are used just for demo

purposes. For testing, different testing text files will be used. The testing text file will contain

only one line that is very long with only one end of file and one EOF.

You function should be based on the following function that we covered in class:

Char* fgets (char *s, int count, FILE *stream)

Copy of this function developed for demonstration purposes by Dr. Lamb is available at the

following Linux directory:

cas/course/cisc220/IO/IOtest5.c

You may use the IOtest5 in your program and improve on it so it will not split a word into two

parts. Or you may develop your own similar function, which is better.

Same concepts that are used in IOtest5.c should be used in your function.

If your function works properly with different set of text files and different lengths of lines, then

it will be given full mark.

More Requirements:

Your program must be in a single file called CISC220-Assn6.XXXX.c

the XXXX represent your last four digits of your students ID.

Marking Scheme:

If you use pointers in your functions, and if your function works properly with different set of

text files and different lengths of lines, then it will be given full mark of 20 marks.

If you do not follow the assignment requirements -- especially if you deviate from them in a way

that costs us time while marking -- you will lose administrative points even if your program

works correctly. So please read the directions carefully.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp