Advertisement
HimikoWerckmeister

Untitled

Feb 21st, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 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)) // this conditional not correct b.c you don't accept input first time
  29. // around
  30. while(i>0)
  31. {
  32. cin>>sDeviceName;
  33. DeviceNames.push_back(sDeviceName);
  34. cout << "The value of i before dec is: " << i << endl;
  35. i--;
  36. cout << "The value of i after dec is: " << i << endl;
  37. }
  38. cout << "The actual device vector" << endl;
  39. for(unsigned int i=0;i<DeviceNames.size();i++)
  40. {
  41. cout<<"The device name at " <<i<<"is: "<<DeviceNames[i]<<endl;
  42.  
  43. }
  44. cout << "Enter the device outputs here: "<< endl;
  45. int j=iDeviceNum;
  46. while(j>0)
  47. {
  48. cin>>iDeviceOutput;
  49. vDeviceOutputs.push_back(iDeviceOutput);
  50. j--;
  51. }
  52. //for(unsigned int i=0;i<vDeviceOutputs.size();i++)
  53. //{
  54. //cout<<"The device outputs at "<<i<< " are " <<vDeviceOutputs[i]<<endl;
  55. //}
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement