SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <array>
  3. using namespace std;
  4.  
  5.  
  6. struct QueueItem {
  7.     int func(string);
  8.     string params;
  9. };
  10.  
  11. int testFunc1 (string param) {
  12.     cout << param << " testFunc1";
  13.     return 0;
  14. }
  15.  
  16. int testFunc2 (string param) {
  17.     cout << param << " testFunc2";
  18.     return 0;
  19. }
  20.  
  21. int testFunc3 (string param) {
  22.     cout << param << " testFunc3";
  23.     return 0;
  24. }
  25.  
  26.  
  27.  
  28.  
  29. int main () {
  30.     array<QueueItem,3> queue;
  31.    
  32.     queue[1].func = testFunc2;
  33.     queue[1].params = "wert";
  34.     queue[2].func = testFunc3;
  35.     queue[2].params = "kjgh";
  36.  
  37.     int queueSize = queue.size();
  38.  
  39.     for (size_t i = 0; i < queue.size(); i++)
  40.     {
  41.         queue[i].func(queue[i].params);
  42.     }
  43.    
  44.     cout << "Hello World";
  45.     return 0;
  46. }
RAW Paste Data
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