Guest User

Untitled

a guest
Apr 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. // ConsoleApplication2.cpp: определяет точку входа для консольного приложения.
  2. //
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <vector>
  6. #include "string.h"
  7. #include <cstdlib>
  8.  
  9. class neyron {
  10. public:
  11. neyron()
  12. {
  13. }
  14.  
  15. neyron(std::string name, float weight)
  16. {
  17. this->setValue(name, weight);
  18. }
  19.  
  20. void setValue(std::string name, float weight) {
  21. this->NAME = name;
  22. this->WEIGHT = weight;
  23. }
  24.  
  25. std::string getName()
  26. {
  27. return this->NAME;
  28. }
  29.  
  30. float getWeight() {
  31. return this->WEIGHT;
  32. }
  33.  
  34. private:
  35. std::string NAME;
  36. float WEIGHT;
  37. };
  38.  
  39.  
  40. class neyronsList {
  41. public:
  42. neyronsList()
  43. {
  44. }
  45.  
  46. int addValue(std::string name, float weight) {
  47. Base.push_back(*new neyron(name, weight));
  48. return this->getSize();
  49. }
  50.  
  51. int getSize() {
  52. return Base.size();
  53. }
  54.  
  55. neyron getValue(int index) {
  56. return Base[index];
  57. }
  58.  
  59. private:
  60. std::vector<neyron> Base;
  61. };
  62.  
  63.  
  64. int main() {
  65. neyronsList *WORKER;
  66. WORKER = new neyronsList();
  67.  
  68. WORKER->addValue("HERON", 6.34635);
  69.  
  70. printf("%f", WORKER->getValue(0).getWeight());
  71. system("pause");
  72. return 0;
  73. }
Add Comment
Please, Sign In to add comment