G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 7th, 2020 157 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <fstream>
  4. #include <ctime>
  5. #include <vector>
  6.  
  7. void generazione_dati (int &a, int &b) {
  8.     std::fstream f;
  9.     f.open ("conf.txt");
  10.     a = rand()% 25 + 1;
  11.     b = rand()% 25 + 1;
  12.     f << a << b << ",";
  13.     f.close();
  14. }
  15.  
  16. void riempimento_dati (int a, int b, std::vector<std::vector<int>> &v) {
  17.     for (int i=0; i<a; ++i) {
  18.         for (int j=0; i<b; ++j)
  19.             v[i].push_back(rand()% 256);
  20.     }
  21. }
  22.  
  23. void caricamento_dati (int a, int b, std::vector<std::vector<int>> &v) {
  24.     std::fstream f;
  25.     f.open ("data.csv");
  26.     for (int i=0; i<a; ++i) {
  27.         for (int j=0; j<b; ++j) {
  28.             if (j = b-1)
  29.                 f << v [i][j];
  30.             else
  31.                 f << v [i][j] << ",";
  32.         }
  33.         f << "\n";
  34.     }
  35.     f.close();
  36. }
  37.  
  38. int main() {
  39.     srand(time(NULL));
  40.     int a, b;
  41.     generazione_dati (a, b);
  42.     std::vector<std::vector<int>> v;
  43.     riempimento_dati (a, b, v);
  44.     caricamento_dati (a, b, v);
  45.     return 0;
  46. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top