實驗內容五

2022-06-04 10:21:07 字數 3702 閱讀 3627

#include #include #include #include using namespace std;

// 函式宣告

void output1(vector&);

void output2(vector&);

int main()

// 函式實現

// 以下標方式輸出vector陣列物件v的元素值

void output1(vector&v)

// 函式實現

// 以迭代器方式輸出vector陣列物件v的元素值

void output2(vector&v)

//原題 

/*#includeusing namespace std;

int main()

*//*定義指標只是分了一片記憶體用於儲存位址,但該位址需要指向記憶體單元,

原題中指標沒有指定記憶體單元,會隨機指向某處記憶體,

直接賦值就是越界了,導致程式崩潰

*/ //改正後

#includeusing namespace std;

int main()

/*

#includeusing namespace std;

int fn1()

int main()

*///原題中用new申請了空間,但是沒有釋放它

#includeusing namespace std;

int fn1()

int main()

#ifndef matrix_h

#define matrix_h

#pragma once

#includeusing namespace std;

class matrix ;

#endif

#include"matrix.h"

#include#includeusing namespace std;

matrix::matrix(int n)

matrix::matrix(int n, int m)

matrix::matrix(const matrix &x) }}

matrix::~matrix(){}

void matrix::setmatrix(const float *pvalue)

}void matrix::printmatrix() const

cout << endl;

}float & matrix::element(int i, int j)

float matrix::element(int i, int j) const

void matrix::setelement(int i, int j, int value)

int matrix::getlines() const

int matrix::getcols() const

// matrix.cpp: 定義控制台應用程式的入口點。

//#include "stdafx.h"

#include#include"matrix.cpp"

#pragma once

using namespace std;

int main()

, n[8] = ;

const float *pvalue1 = m, *pvalue2 = n;

a.setmatrix(pvalue1);

b.setmatrix(pvalue2);

cout << "矩陣a為:" << endl;

a.printmatrix();

cout << "矩陣b為:" << endl;

b.printmatrix();

a.setelement(1, 2, 666);

cout << "修改後,矩陣a第二行第二列的值為:" << a.element(2, 2) << endl;

cout << "矩陣a為:" << endl;

a.printmatrix();

a.~matrix();

b.~matrix();

return 0;

}

因為程式執行的速度較快,500次在一秒內跑完,所以得到的結果只會是0或者1。所以我找到了將rand的秒變為毫秒計算的**

#include#include#include#includeusing namespace std;

class dice;

dice::dice(int n):sides(n)

dice::cast()

int main();

#endif // !user_h

#include"user.h"

#include#includeusing namespace std;

int user::currentid = 999;

user::user()

void user::print()

void user::changepassword()

else

} if (count == 3)

}void user::printcurrentid()

// 使用者管理.cpp: 定義控制台應用程式的入口點。

//#include "stdafx.h"

#include #include #include "user.h"

using namespace std;

int main()

else if (number == 2)

else if (number == 3)

else if (number == 4)

else if (number == 0)

} return 0;

}

#ifndef book_h

#define book_h

#include using std::string;

class book ;

#endif

#include "book.h"

#include #include using namespace std;

// 建構函式

// 補足程式

book::book(string isbnx,string titlex,float pricex):isbn(isbnx),title(titlex),price(pricex){}

// ...

// 列印圖書資訊

// 補足程式

void book::print()

// ...

#include "book.h"

#include #include using namespace std;

int main()

// ...

// 輸出入庫所有圖書資訊

// 補足程式

for (int i = 0; i < count; i++)

// ...

return 0;

}

實驗五實驗報告

系統架構圖 首先我在我的電腦裡建立了有名稱要求的資料夾,然後開啟android studio clone了我們的小組專案。此處因為已經clone過了,所以無法再把這個專案clone進去 進行編譯,執行,測試均正常 我在遊戲主介面載入了乙個toast,點選可以短暫地顯示我的學號資訊 首先在封面檔案裡我...

實驗報告 實驗五

實驗內容 1.將老師給的程式框架編譯 連線後利用反彙編u檢視 長度,利用g命令將程式執行至在mov ax,4c00h結束語句前。1 發現data中的資料被改為 中指定的資料。2 程式返回前,cs 076c ss 076b ds 076a。3 程式執行後,設code段位址為x,則data段位址為x 2...

部落格實驗五

實驗目標 掌握路由器幾種常用配置方法 掌握採用console線纜配置路由器的方法 掌握採用telnet方式配置路由器的方法 熟悉路由器不同的命令列操作模式以及各種模式之間的切換 掌握路由器的基本配置命令 實驗背景 你是某公司新進的網管,公司要求你熟悉網路產品,首先要求你登入路由器,了解 掌握路由器的...