Advertisement
HimikoWerckmeister

Unexpected Behav

Feb 21st, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. //#define _GNU_SOURCE
  2. #include<iostream>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <pthread.h>
  6. #include <string.h>
  7. #include <vector>
  8. using namespace std;
  9.  
  10. int main(int argc, char **argv)
  11. {
  12. int iDeviceNum=0;
  13. string sDeviceName;
  14. //int iDeviceOutput=0;
  15. vector<float>vDeviceOutputs; // expressed in terms of outputs
  16. vector<string> DeviceNames;
  17. cout << "Enter a number for the amount of devices your person has" << endl;
  18. cin >> iDeviceNum;
  19. cout << "The amount of devices are: " << iDeviceNum << endl;
  20.  
  21. cout<<"Enter the device Names here" << endl;
  22. /*for(int i=0;i<iDeviceNum;i++)
  23. {
  24. cin>>sDeviceName;
  25. DeviceNames.push_back(sDeviceName);
  26. }*/
  27. int i=iDeviceNum;
  28. while((cin>>sDeviceName) && (i>0))
  29. {
  30. DeviceNames.push_back(sDeviceName);
  31. i--;
  32. cout << "The value of i is: " << i << endl;
  33. }
  34. cout << "The actual device vector" << endl;
  35. for(unsigned int i=0;i<DeviceNames.size();i++)
  36. {
  37. cout<<DeviceNames[i]<<endl;
  38. cout<<"The value of i is: "<< i <<endl;
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement