freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

程序員培訓指南-資料下載頁

2025-07-07 15:51本頁面
  

【正文】 k = GetK(Degree, Curve, ITEMS)。 printf( %3d % \n,Degree,k)。 }}double GetK(int Temp, CURVE *p, int n){ /*用二分法在n個元素的有序表p中查找與Temp對應的傳感器輸出值*/ int low,high,m。 double Step。 low = 0。 high = n1。 if ( (Temp pTemp) ||( Temp (p+high)Temp) ) return 。 /**/ while (low = high) { m = (1) 。 if ( Temp == (p+m)Temp ) return (2) 。 if ( Temp (p+m)Temp ) high = m1。 else low = (3) 。 } p += high。 Step = ( (4) ) / ((p+1)Temp pTemp)。 return (pRatio +Step * ( (5) ))。}試題四(共15分)閱讀以下說明和C語言函數(shù),將應填入 (n) 處的字句寫在答題紙的對應欄內?!菊f明】函數(shù)sort(NODE *head)的功能是:用冒泡排序法對單鏈表中的元素進行非遞減排序。對于兩個相鄰結點中的元素,若較小的元素在前面,則交換這兩個結點中的元素值。其中,head指向鏈表的頭結點。排序時,為了避免每趟都掃描到鏈表的尾結點,設置一個指針endptr,使其指向下趟掃描需要到達的最后一個結點。例如,對于圖41 (a)的鏈表進行一趟冒泡排序后,得到圖41 (b)所示的鏈表。圖41鏈表的結點類型定義如下:typedef struct Node { int data。 struct Node *next。}NODE?!綜語言函數(shù)】void sort(NODE *head) { NODE *ptr,*preptr,*endptr。 int tempdata。 ptr = head next。 while ( (1) ) /*查找表尾結點*/ ptr = ptr next。 endptr = ptr。 /*令endptr指向表尾結點*/ ptr = (2) 。 while(ptr != endptr) { while( (3) ) { if (ptrdata ptrnextdata){ tempdata = ptrdata。 /*交換相鄰結點的數(shù)據(jù)*/ ptrdata = ptrnextdata。 ptrnextdata = tempdata。 } preptr = (4) 。 ptr = ptr next。 } endptr = (5) 。 ptr = headnext。 }}(從下列2題中任選1題解答)試題五(15分,每空3分)閱讀以下說明和C++程序,將應填入(n) 處的字句寫在答題紙的對應欄內?!菊f明】以下程序的功能是計算三角形、矩形和正方形的面積并輸出。程序由4個類組成:類Triangle、Rectangle和Square分別表示三角形、矩形和正方形;抽象類Figure提供了一個純虛擬函數(shù)getArea(),作為計算上述三種圖形面積的通用接口?!綜++程序】include include class Figure {public: virtual double getArea() = 0。 // 純虛擬函數(shù)}。class Rectangle : (1) {protected: double height。 double width。public: Rectangle(){}。 Rectangle(double height, double width) { thisheight = height。 thiswidth = width。 } double getArea() { return (2) 。 }}。class Square : (3) {public: Square(double width){ (4) 。 }}。class Triangle : (5) { double la。 double lb。 double lc。public: Triangle(double la, double lb, double lc) { thisla = la。 thislb = lb。 thislc = lc。 } double getArea() { double s = (la+lb+lc)/。 return sqrt(s*(sla)*(slb)*(slc))。 }}。void main() { Figure* figures[3] = { new Triangle(2,3,3), new Rectangle(5,8), new Square(5) }。 for (int i = 0。 i 3。 i++) { cout figures[ i ] area = (figures[i])getArea() endl。 }}試題六(共15分,每空3分)閱讀以下說明和Java源程序,將應填入(n) 處的字句寫在答題紙的對應欄內?!菊f明】以下程序的功能是計算三角形、矩形和正方形的面積并輸出。程序由5個類組成:AreaTest是主類,類Triangle、Rectangle和Square分別表示三角形、矩形和正方形,抽象類Figure提供了一個計算面積的抽象方法?!境绦颉縫ublic class AreaTest{ public static void main(String args[]) { Figure[] figures={ new Triangle(2,3,3), new Rectangle(5,8), new Square(5)}。 for (int i=0。 i。i++) { (figures[i]+area=+figures[i].getArea())。 } }}public abstract class Figure { public abstract double getArea()。}public class Rectangle extends (1) { double height。 double width。 public Rectangle(double height,double width){=height。=width。 } public String toString(){return Rectangle:height=+height+,width=+width+:。 } public double getArea(){return (2) 。 }}public class Square extends (3) { public Square(double width) { (4) 。 } public String toString() {return Square:width=+width+:。 }}public class Triangle extends (5) { double la。 double lb。 double lc。public Triangle(double la,double lb,double lc) { =la。 =lb。 =lc。}public String toString(){ return Triangle:sides=+la+,+lb+,+lc+:。}public double getArea() { double s=(la+lb+lc)/。 return (s*(sla)*(slb)*(slc))。}}22 / 2
點擊復制文檔內容
教學課件相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1