华南俳烁实业有限公司

自考

各地資訊
當前位置:考試網(wǎng) >> 自學考試 >> 自考真題 >> 工學類 >> C語言程序設計 >> 文章內容

排行熱點

全國2011年1月高等教育自學考試C++程序設計試題_第6頁

來源:考試網(wǎng) [ 2011年12月10日 ] 【大 中 小】
54.給出下面程序的輸出結果。
  include<iostream>
  #include<string>
   using namespace std;
   class Book  {
   char*title;
   char*author;
   int numsold;
   public:
     Book(){}
     Book(const char*strl,const char*str2,const int num)    {
      int len=strlen(strl);
      title=new char[1en+1];
      strcpy(title,strl);
      len=strlen(str2);
    author=new char[1en+1];
      strcpy(author,str2);
      numsold=num;  }
  void sethook(const char * strl,const char * str2,const int num)  {
      int len=strlen(strl);
      title=new char[1en+1];
      strcpy(title,strl);
      len=strlen(str2);
      author=new char[1en+1];
    strcpy(author,str2);
    numsold=num;
      }
      ~Book()  {
        delete title;
        delete author;
      }
  void print(ostream& output)  {
    output<<"書名:"<<title<<endl;
    output<<"作者:"<<author<<endl;
    output<<"月銷售量:"<<numsold<<endl;
  }
};
void main()    {
Book objl("數(shù)據(jù)結構","嚴蔚敏",200),obj2;
objl.print(cout);
obj2.setbook("C++語言程序設計","李春葆",210);
obj2.print(cout);
}
六、程序設計題(本大題共l小題,共10分)
55.在三角形類TRI實現(xiàn)兩個函數(shù),功能是輸入三個頂點坐標判斷是否構成三角形
   #include<iostream.h>
   #include<math.h>
   class point{
   private:float x,y;
   public:point(float a,float b){x=a;y=b;}
     point(){x=O;y=O;}
     void set(float a,float b){x=a;y=b;}
     float getx(){return x;}
     float gety(){return y;}
   };
   class tri{
   point x,y,z;
   float sl,s2,s3;
   public:....settri(....);//用于輸入三個頂點坐標
    ....test(....);//用于判斷是否構成三角形
  };請寫出兩個函數(shù)的過程(如果需要形式參數(shù),請給出形參類型和數(shù)量,以及返回值
  類型)

首頁 1 2 3 4 5 6 尾頁
責編:snrvge
搜索| 米脂县| 武山县| 汕头市| 通城县| 石棉县| 荣昌县| 汝南县| 阳高县| 万盛区| 武安市| 怀化市| 龙井市| 治多县| 张家港市| 措勤县| 五原县| 禹州市| 贵南县| 浙江省| 电白县| 措勤县| 邢台市| 宜黄县| 安阳县| 福建省| 醴陵市| 泸溪县| 天全县| 通山县| 汨罗市| 临沭县| 延吉市| 沧源| 沅陵县| 太仆寺旗| 宁安市| 泾阳县| 长宁区| 金乡县| 曲靖市|