[ create a new paste ] login | about

Link: http://codepad.org/lqDGJtZp    [ raw code | output | fork ]

C++, pasted on Jan 25:
#include<iostream>
#include<vector>

using namespace std;

typedef struct{
  int powerlevel;
  int tx_time;
}timeInPowerLevel;

vector<timeInPowerLevel> prevTimePowerLevel;

int main()
{
  vector<timeInPowerLevel> newTimePowerLevel;
  
  for(int i = 0; i < 5; i++)
  {
    timeInPowerLevel Ptx = {i,i*5};
    newTimePowerLevel.push_back(Ptx);
  }

  for(int i = 0; i < 5; i++)
  {
    cout<<" New : PowerLevel: "<< newTimePowerLevel[i].powerlevel<<"\t tx_time:"<<newTimePowerLevel[i].tx_time<<endl;
  }
  
 prevTimePowerLevel = newTimePowerLevel;

  for(int i = 0; i < 5; i++)
  {
    cout<<" Prev : PowerLevel: "<< newTimePowerLevel[i].powerlevel<<"\t tx_time:"<<newTimePowerLevel[i].tx_time<<endl;
  }
  
  return 1;
}


Output:
1
2
3
4
5
6
7
8
9
10
 New : PowerLevel: 0	 tx_time:0
 New : PowerLevel: 1	 tx_time:5
 New : PowerLevel: 2	 tx_time:10
 New : PowerLevel: 3	 tx_time:15
 New : PowerLevel: 4	 tx_time:20
 Prev : PowerLevel: 0	 tx_time:0
 Prev : PowerLevel: 1	 tx_time:5
 Prev : PowerLevel: 2	 tx_time:10
 Prev : PowerLevel: 3	 tx_time:15
 Prev : PowerLevel: 4	 tx_time:20


Create a new paste based on this one


Comments: