<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      實驗5

      1

      #include <iostream>
      #include <vector>
      #include <string>
      using namespace std; 
      void output1(vector<string> &);  
      void output2(vector<string> &); 
      int main()
      {
      vector<string>likes, dislikes;
      string ch,ch1;
      cout<<"為likes添加元素,輸入-1結束"<<endl; 
      while(cin>>ch,ch!="-1")
      {
          likes.push_back(ch);
       } 
      cout << "-----I like these-----" << endl;
      output1(likes);
      cout<<"為dislikes添加元素,輸入-1結束"<<endl;
      while(cin>>ch1,ch1!="-1"){
          dislikes.push_back(ch1);
      } 
      cout << "-----I dislike these-----" << endl;
      output2(dislikes);
      likes.swap(dislikes);
      cout << "-----I likes these-----" << endl;
      output1(likes);
      cout << "-----I dislikes these-----" << endl;
      output2(dislikes);                      
      return 0;
      }
      void output1(vector<string> &v) {
      for(int i=0;i<v.size();i++)
      {
          cout<<v[i]<<endl;
      }
      }
      void output2(vector<string> &v) {
      for(vector<string>::iterator it = v.begin();it!=v.end();++it)cout<<(*it)<<endl;
      } 

      2

       

      #include <iostream>
      using namespace std;
      int main()
      {
          int a; 
          int *p=&a;
          *p=9;
          cout<<"The value at p: "<<*p;
          return 0;
      }

       

      #include <iostream>
      using namespace std;
      int fn1(){
          int *p=new int(5);
          return *p;
          delete p;
      }
      int main()
      {
          int a=fn1();
          cout<<"the value of a is: "<<a;
          return 0;
      }

      3

      matrix.h

      #ifndef MATRIX_H
      #define MATRIX_H
      class Matrix {
      public:
          Matrix(int n);
          Matrix(int n, int m);
          Matrix(const Matrix &X); 
          ~Matrix(); 
          void setMatrix(const float *pvalue);
          void printMatrix() const;
          inline float &element(int i, int j) {
              return p[i*lines + j];
          inline float element(int i, int j) const {
              return p[i*lines + j];
          }
          void setElement(int i, int j, int value);
          inline int getLines() const {
              return lines;
          }
          inline int  getCols() const {
              return cols;
          }
      private:
          int lines;
          int cols;
          float *p; 
      };
      #endif

      matrix.cpp

      #include "stdafx.h"
      #include "matrix.h"
      #include<iostream>
      using namespace std;
      
      Matrix::Matrix(int n)
      {
          lines = n;
          cols = n;
      }
      Matrix::Matrix(int n, int m)
      {
          lines = n;
          cols = m;
      }
      Matrix::~Matrix()
      {
          delete[]  p;
      }
      Matrix::Matrix(const Matrix &X)
      {
          lines = X.lines;
          cols = X.cols;
          p = X.p;
      }
      void Matrix::setMatrix(const float *pvalue)
      {
          for (int i = 0; i < lines*cols; i++)
              p[i] = pvalue[i];
      }
      void Matrix::printMatrix() const
      {
          cout << "The Matrix is:" << endl;
          for (int i = 0; i < lines; i++)
          {
              for (int j = 0; j < cols; j++)
                  cout << p[i*lines+j] << " ";
              cout << endl;
          }
      }
      void Matrix::setElement(int i, int j, int value)
      {
          element(i, j) = value;
      }

      main.cpp

      #include "stdafx.h"
      #include <iostream>
      #include "matrix.h"
      using namespace std;
      
      int main()
      {
          Matrix m(4);
          const float *pvalue[20] = { 0 };
          m.setMatrix(*pvalue);
          m.setElement(2, 4, 6);
          m.printMatrix();
          return 0;
      }

       4

      第一題

      #include "stdafx.h"
      #include<iostream>
      #include<time.h>
      using namespace std;
      
      class dice {
      public:
          dice(int d);
          int cast();
      private:
          int sides;
      };
      dice::dice(int d) {
          sides = d;
      }
      int dice::cast()
      {
          
          int p = rand() % sides + 1;
          return p;
      }
      int main()
      {
          srand((unsigned)(time(NULL)));
          dice d(40);
          int k = 0;
          
          for (int i = 1; i <= 500; i++)
          {
              if (d.cast() == 16)
                  k++;
          }
          cout << k << endl;
          return 0;
      }

       

      posted @ 2018-05-23 16:45  群藝術啊  閱讀(95)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 欧洲一区二区中文字幕| 日本亚洲一区二区精品久久| 中文字幕人妻互换av久久| 精品无码国产日韩制服丝袜| 起碰免费公开97在线视频| 亚洲色一色噜一噜噜噜| 亚欧美闷骚院| 无码人妻丝袜在线视频| 午夜成人性爽爽免费视频| 国产乱子伦一区二区三区视频播放| 四虎永久精品在线视频| 国产成本人片无码免费| 免费国产一区二区不卡| 亚洲精品亚洲人成在线| 中国性欧美videofree精品| 久久热这里只有精品最新| 精品中文字幕一区在线| 成人免费无遮挡在线播放| 亚洲精品电影院| 卡一卡2卡3卡精品网站| 东乡| 久久99久久99精品免视看国产成人| 色综合久久综合中文综合网| 欧美日韩免费专区在线观看| 亚洲精品日韩在线丰满| 精品国产不卡在线观看免费| 国产高清视频在线播放www色| 亚洲国产午夜精品理论片妓女| 蜜桃av无码免费看永久| 三上悠亚久久精品| 人妻少妇偷人作爱av| 亚洲第一无码专区天堂| 国产丝袜在线精品丝袜不卡| 大洼县| 韩国三级+mp4| 亚洲AV天天做在线观看| 亚洲一区二区中文字幕| 在线观看国产成人av天堂| 亚洲永久精品一区二区三区| 国产精品自在线拍国产手机版 | 国产精品一码二码三码四码|