為題目造資料

2022-09-09 17:27:37 字數 701 閱讀 6016

c++讀寫資料特有的方式是

#include...

ifstream is("檔名1");//或者ifstream is("檔名1",ios::in,0);

ofstream os("檔名2");//或者ofstream os("檔名2",ios::out,0);

...is>>x;

...os《但這種方式太慢了,要用is讀入檔案中的資料,用os寫出資料,操作繁雜

有這樣一種方式,輸入輸出重定向,可以用printf向檔案輸出資料,用scanf向檔案輸入資料

必備標頭檔案:

#include//rand()函式

#include//time(0)種子

#include//freopen()重定向

輸入輸出重定向:

file freopen(const char* filename, const char* mode, file* stream);

形參說明:

filename:需要重定向到的檔名或檔案路徑。

mode:代表檔案訪問許可權的字串。例如,"r"表示「唯讀訪問」、"w"表示「只寫訪問」、"a"表示「追加寫入」。

stream:需要被重定向的檔案流。

造資料的main函式:

int main()

如何造資料

當我們自己想出題時,就需要我們自己出資料啦qwq。這裡以出a bproblem的資料為例qwq。模板 include includeusing namespace std define rand rand 15 rand const int maxn 1e5 40 char a maxn b max...

若澤資料 造資料作業用Python造資料

coding utf 8 import random 引入random函式 import time 引入time 函式 url paths的陣列 url paths class 112.html class 128.html class 145.html class 146.html class 1...

Oracle批量造資料

今天專案中要做效能測試,需要在oracle中乙個表造5000萬的資料,總結如下 1.最好10000次提交一次 2.注意表空間的大小 3.面對主鍵唯一的情況,最好用乙個單獨的計數器,直接用i j會有重複,插入不成功 create orreplace procedure sp proc1 asv num...