Advertisement
apl-mhd

structer constructor

Jul 22nd, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. // A Dynamic Programming based solution for 0-1 Knapsack problem
  2. #include<stdio.h>
  3. #include <iostream>
  4. #include <algorithm>
  5. #include <limits>
  6. #include <queue>
  7. using namespace std;
  8.  
  9.  
  10. struct q{
  11.    
  12.     q(int a, char ch) : number(a), charcter(ch){}
  13.    
  14.     int number;
  15.     char charcter;
  16. };
  17.  
  18. typedef struct q q;
  19.  
  20.  
  21.  
  22.  
  23. int main()
  24. {
  25.     queue<int> x;
  26.    
  27.     queue<q>y;
  28.    
  29.     y.push(q(10,'c'));
  30.    
  31.     cout<<y.front().charcter;
  32.    
  33.    
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement