哪位高人帮帮忙,有个小小的程序帮忙做一下!谢谢!

问题描述

(Questionsmarked*areforextrapracticeanddonotneedtobedemonstratedtothelecturer.)(Youonlyneedtosavethe.cppfileforeachquestion.Ifyoumakeanewprojectforeachprogram,youwillrunoutofspace.Thereforeyoumusteitherdeletealltheotherfilesorhaveoneprojectandreplacethe.cppfileeachtime.)LECTURE2:11.Writeaprogramcontainingthefollowingcodeandthenmodifyitsothatitalsoprintsthesquareofn-1.12.Modifyyourprogramfromquestion11touseaforlooptoachieveexactlythesamefunctionality.13.Modifyyourprogramfromquestion11touseadowhilelooptoachieveexactlythesamefunctionality.Whathappensifthefirstnumberenteredis0?14.Writeandrunaprogramthatreadsapositiveintegernandthenprintsatriangleofasterisksinthatnumberofrows.Useaforloop.Forexample,ifnis4,thentheoutputwouldbe:**********14*.Canyoumodifyyourcodefromquestion14todisplayadiamond?E.g.forsize3theoutputwouldbe:*************15.Usethedebuggertostepthroughyourcodefromquestion14.Noticehowthecodeintheloopisrepeatedandwatchthechangingvalueofthevariablecontrollingtheloop(seeWatchwindow).Findouthowtosetabreakpointandruntheprogramtostopatthebreakpoint.Canyoualsoruntocursor?16.Writeandtestafunctionvoidtriangle(intn)tooutputatriangleofasterisks(asinquestion15).16*.Canyoumodifythefunctionfromquestion16topassacharacterasaparameteraswell?17.Writeandtestafunctionthatreturnstheareaofacirclewithgivenradius.Thefunctionshouldhavethefollowingprototype:floatarea(floatr)18.Writeandtestafunctionthatdetermineswhetheragivenintegerisaprimenumber.(Thenumbernisprimeifitisnotdivisiblebyanyintegergreaterthan1andlessthann.)Thefunctionshouldreturn1ifthenumberisprimeand0otherwise.Thefunctionprototypeshouldbeasfollows:intisPrime(intn)(N.B.Thefirsttenprimenumbersare2,3,5,7,11,13,17,19,23and29.)19.Writeandtestafunctionthatreturnstheareaaandcircumferencecofacirclewithgivenradiusr.Thefunctionshouldhavetheprototype:voidcomputeCircle(float&a,float&c,floatr)20.Writeandrunaprogramthatreadsinintegersintoanarrayinreverseandthendisplaysthemintheorderthattheyarestored.Forexample,thefirstnumberreadinisstoredinthelastpositionandisdisplayedlast.21.Writeandtestafunctionthatreplacesallthenegativenumbersinanarrayofintegerswiththeirabsolutevalues.Yourfunctionmustworkforarraysofdifferentsizes.22.Writeandtestafunctionthatreturnstheminimumvaluestoredinanarray.Modifyyourfunctionsothatitalsoreturnstheindexoftheminimumvaluestoredinanarray.23.Writeandtestthefollowingfunctionthatattemptstoremoveanitemfromanarray:intremove(inta[],int&n,intx)Thefunctionsearchesthefirstnelementsofthearrayafortheitemx.Ifxisfound,itisremoved,alltheelementsabovethatpositionareshifteddown,nisdecremented,and1isreturnedtoindicateasuccessfulremoval.Ifxisnotfound,thearrayisleftunchangedand0isreturnedtoindicate“failure”.23*.Modifythefunctionfromquestion23toremovealloccurrencesofxinthearrayandthenreturnthetotalnumberofelementsremoved.Isitdoingitthemostefficientway?

解决方案

解决方案二:
人家叫你用c语言写

时间: 2024-09-14 11:36:15

哪位高人帮帮忙,有个小小的程序帮忙做一下!谢谢!的相关文章

数据结构-谁能帮我画一下这个程序的流程图 ,谢谢

问题描述 谁能帮我画一下这个程序的流程图 ,谢谢 #include #include //调用stdlib.h struct Node //定义一个自定义struct结构,名字为node.struct为关键字,结构体的意思 { int data; struct Node next;.//定义一个指向Node这种结构体的指针 }; struct Node *head; //头指针 struct Node * CREAT(); void search(); void insert(); void D

哪位高人帮我解决一个困扰我几天的问题,httpwebrequest 访问 https

问题描述 使用httpwebrequest来模拟浏览器访问网页,提交数据,前面几个网页的提交和返回都没有问题,但是到用户登录页面的时候,请求一个登录跳转页面,服务器返回302跳转到https登录页面的时候,老是返回会话超时页面,正确的应该是返回登录页面,不知道是什么原因.是不是cookies设置有问题,还是httpwebrequest在http和https跳转的时候需要什么特殊的设置?在线等啊. 解决方案 解决方案二:高人过来啊,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

哪位朋友帮我解释一下这段代码啊,谢谢了!!!

问题描述 publicpartialclassforumlist:FunctionBase{protectedvoidPage_Load(objectsender,EventArgse){if(Request["type"]==null){Response.Redirect("/code/forumindex.aspx");return;}newscontent.InnerHtml=ShowTopNews();stringtype_sql="select*

c#调用c++编写的dll总是出现问题,哪位高手帮帮忙

问题描述 我的这个程序,使用c#调用c++编写的dll,总是出现以下这个问题,那位高手能够帮帮忙,小女子在此先感谢了.大家就救我吧.c++编写的dll中的函数voidEFSgetUsrThesaurus(pUsrDicFileNameTableDicFlNmTbl,pUsrKeyWordTableKeyWdTbl,pUsrThesaurusTableThTbl,EFSDICSTATUS*EFS_dicstatus);c++中的结构体typedefstruct{intCnt;struct{char

代码-哪位大哥帮我看下,for循环执行不了,只能执行一条记录,跪谢。

问题描述 哪位大哥帮我看下,for循环执行不了,只能执行一条记录,跪谢. cust_list.asp页面中的代码如下: function del(){ var num=document.getElementById("ckcount"); if(num.innerHTML=="0") { alert('至少要选择一条记录') } else{ if(confirm('确定要删除该表资料吗?')) { var number=document.getElementById

有哪位高人知道怎么将16进制表示的float64数据转换为10进制数据

问题描述 有哪位高人知道怎么将16进制表示的float64数据转换为10进制数据,我看到有人说"16进制:41F075D841873600转换后是:16.9013671875(十进制)"请问怎么转啊,帮我看看,以3fe36614aadabcc9为例,转出来是多少? 解决方案 解决方案二:41F075D841873600==4751427178548639232用计算器解决方案三:??16进制:41F075D841873600byte[]bs={0x00,0x36,0x87,0x41};

c语言-这是我函数中的一个循环,哪位亲帮我看看哪出了问题

问题描述 这是我函数中的一个循环,哪位亲帮我看看哪出了问题 这是我函数中的一个循环,哪位亲帮我看看哪出了问题 for(i=0;i<144;i++) { int n=i/12; double x0=0.0;double z0=n*3.0+1.5;//射线始点 //double x=x0;double z=z0;//转换点 if(ray[i].slope>0.0) { double X1[13]={0.0};double Z1[13]={0.0};//用纵向线截得的点到射线始点的长度 double

start-想用按钮叫出对话框,可是不知在哪里出了问题,我是刚入门,各位高人帮我看看,大谢了。

问题描述 想用按钮叫出对话框,可是不知在哪里出了问题,我是刚入门,各位高人帮我看看,大谢了. #include #define ID_START 2 LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK StartMenuProc (HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstan

时间复杂度 算法-求高人帮我算下这三重for循环的时间复杂度

问题描述 求高人帮我算下这三重for循环的时间复杂度 for(int i=1;i<row;i++) for(int j=i;j<=col-row+i;j++) for(int k=i;k<j;k++) { //code } 答案说是O(row*col*col)...不懂怎么算出来.也不知道是否有错 请大神能详细说明下解题时间复杂度的步骤吗? 我怎么算出来是O(col*(col-row)*)col)