讲解:C Assignment 2R、R、R

Introduction按照题目要求输入首先是行数,然后是行数行的文本需要生成的assign2.txt在src文件夹下void GetWord(char str,char word){int i;int j;int l;char tmp[82];word[0]=’\0’;l=strlen(str);i=0;j=0;while(iRequirement60-141 – Introduction to Programming II Summer, 2017Assignment 2(Submission Deadline: Wednesday, Jul. 19, 2017 before 23:59)Text AnalysisThe availability of computers with string-manipulation capabilities has resulted in some ratherinteresting approaches to analyzing the writings of great authors. Much attention has been focusedon whether William Shakespeare ever lived. Some scholars find substantial evidence thatChristopher Marlowe actually penned the masterpieces attributed to Shakespeare. Researchershave used computers to find similarities in the writings of these two authors. Regardless of thisparticular controversy, this assignment examines three methods for analyzing texts with a computer.Your task is to:Write a complete, well documented C program that reads several lines of text and prints three tablesindicating:1) the number of occurrences of each letter of the alphabet in the complete text2) the number of one-letter words, two-letter words, three-letter words, and so on, appearingin the complete text3) the number of occurrences of each different word in the complete textNote that the term “complete text” used above refers to all characters in all lines of inputted text.Requirements and Hints :1. Given several lines of text, your program should implement at least the following functions (inother words, additional functions may be useful, depending on the approach used):a) void letterAnalysis( ), that gets several lines of text and the number of lines of text as inputparameters and prints a table indicating the number of occurrences of each letter of thealphabet in the complete text.b) int wordLengthAnalysis( ), that gets several lines of text, the number of lines of text and alength as input parameters and returns the number of occurrences of words with that lengthappearing in the text. The main() function should call this function with different word lengthsand then prints a table indicating the number of one-letter words, two-letter words, three-letterwords, and so on, in the text. The maximum word length may be assumed to be 20 letters.c) void wordAnalysis( ), that gets several lines of text and the number of lines of text as inputparameters and prints a table indicating the number of occurrences of each different word inthe text. The program should include the words in the table in the same order in which theyappear in the text.Input:Input is a number (say, int N) and several (i.e. N) lines of text from a file (using input redirection) orfrom the user (using standard keyboard input). For this, first the number (N) of text lines should beread, and then each line of text should be read individually. The maximum number of lines is 10 buteach text line might have different lengths (however, the maximum number of characters in anyindividual line is 80).Hint: You can use a two dimensional array or an array of pointers to save the text lines.For example4To be, or not to be? That is the question:Whether ’tis nobler in the mind to sufferThe slings and arrows of outrageous fortune,Or to take arms against a sea of troubles,Output:The table below is intended to illustrate the output for this assignment, but it is presented for visualconvenience only. Your program will actually produce the output reports so that various outputs aregenerated one after another (First output, followed by Second output, followed by Third output). Inparticular, note the formatting issues to be dealt with. For the First output, the letter count must beright justified in a column of prescribed width. For the Second output, the word “word” is used onlyif the number of words is 1, otherwise “words” is used. FC代写 Assignment 2代写R编程、R程序代做、代写R编程inally, for the Third output, “times” is usedonly when the number of occurrences is greater than 1.First output Second output Third outputTotal letter counts:a: 10b: 4c: 0d: 2e: 15f: 5g: 3h: 6…1 word of length 110 words of length 28 words of length 34 words of length 45 words of length 62 words of length 71 word of length 82 words of length 91 word of length 10“To” appeared 1 time“be,” appeared 1 time“or” appeared 1 time“not” appeared 1 time“to” appeared 3 times“be?” appeared 1 time“That” appeared 1 time“is” appeared 1 time…Note: You do not have to separate punctuation marks (such as comma, dot, or question mark) fromthe words. For example, both “be,” and “be?” counted as a three-letter words above.Requirements:- Write and document a complete C program that is capable of satisfying the requirements of thisassignment problem.- UNDOCUMENTED OR POORLY DOCUMENTED code will automatically lose 50% marks.- PLAGIARIZED work will not be graded and receive a mark of ZERO and reported according to theSenate bylaws.- The question can use of I/O redirection. Please review the textbook for an example on using I/Oredirection from flat files.- TO SUBMIT: No later than the submission deadline, your assignment should be uploaded inBlackboard. Late submissions are not accepted and will receive a mark of ZERO.- Upload your work as an attachment, include both the source file (assign3.c) and the script. file(assign3.txt) - see below how to create the script. file.To create a script. file (one that logs your compilation steps and your output in a text file):1. script. assign2.txt2. cat assign2.c3. cat input.txt4. cc assign2.c5. a.out 6. ls -l7. exit (DO NOT FORGET THIS STEP!!)The example script. execution presumes that the input was specified in the file input.txt. This may bechanged if the input is provided interactively within the program.If you are compiling your code under Cygwin shell, then you need to change line 5 to:5. ./a.exe In line 4, students may prefer to use the gcc compiler to ensure improved warning and errordiagnostic reports from compiling the program. You must have access to gcc in order to make thischange, however.NOTE: Submissions that are not received correctly by the deadline will automatically receive aZERO mark. Late assignment submissions are not accepted!NOTES:1. Your assignment must be RECEIVED by the due date and time. Late assignment submissions areNOT accepted. Keep your script. file, and all your code unmodified as proof of its completion in caseit is not received.2. It is your responsibility to get an early start on the assignment, research and ask questions aheadof time from the due date.3. Marks will be deducted for unclear code (improper spacing and alignment, hard to read programsand missing outputs).4. Make sure you turn in a complete script. file that clearly shows: your code, your compilationprocess, a listing of the directory showing your source file(s) and the a.out with the date/time stamps,and the output. DO NOT SUBMIT a.out FILES!5. PLAGIARISM: CHEATING IS NOT TOLERATED – PLAGIARISM IS CHEATING! You mustsubmit your own work. Students who are suspected of copying someone else’s work will be reportedto the department’s chair and the Dean of Science and be dealt with in accordance with theUniversity policies. You should not share your code with others. Codes that are similar to each otherwill BOTH be reported as potential evidence of copying. It is imperative that you write your own code.6. Authorized/limited help on this assignment may be provided directly from your Lecture or Labinstructors and Teaching Assistants.转自:http://ass.3daixie.com/2019030627560476.html

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,222评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,455评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,720评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,568评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,696评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,879评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,028评论 3 409
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,773评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,220评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,550评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,697评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,360评论 4 332
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,002评论 3 315
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,782评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,010评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,433评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,587评论 2 350

推荐阅读更多精彩内容

  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,448评论 0 13
  • 最近负责的一款产品,是专业领域的安全防护产品。在防护技术上,我们自认是业内最好的之一。可是用户反馈却寥寥,下单订购...
    残品经理H阅读 1,078评论 0 5
  • 问题场景本机操作系统为win10,在VMworkStation中,以最简方式安装了CentOS 7(64位)虚拟机...
    funOfFan阅读 2,221评论 0 1
  • 星期六 晴 每日一我 真的叫充满阳光的一个周末早晨。睡到快九点了,自然醒来。好像这一整周都没好好吃早饭, 胃口马上...
    sophietyl阅读 64评论 0 0
  • 每个人都是一个孤独的个体,而这种孤独,不是朋友之间叽叽喳喳后就能消除的,因为吵闹过后,归于平静,你的内心还是缺乏阳...
    qimiaodeyu阅读 322评论 0 0