Advertisement
Guest User

Untitled

a guest
May 27th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. // ConsoleApplication1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7. #include <sstream>
  8. using namespace std;
  9.  
  10. const double pi = 3.1415926535;
  11. const string nl = "\n";
  12.  
  13. //void ConvertToDoubles()
  14. //{
  15. // if (v == "?")
  16. // {
  17. //
  18. // }
  19. // else
  20. // {
  21. //
  22. // }
  23. //}
  24.  
  25. double vuat(string v, string u, string a, string t)
  26. {
  27. double result;
  28. if ((v == "?") && (u != "?") && (a != "?") && (t != "?"))
  29. {
  30. // Missing V
  31. u.ToDoubl
  32. double newU, newA, newT;
  33. stringstream convert(u);
  34. convert >> newU;
  35. stringstream convert(a);
  36. convert >> newA;
  37. stringstream convert(t);
  38. convert >> newT;
  39. result = newU + (newA * newT);
  40. return result;
  41. }
  42. else if ((v != "?") && (u == "?") && (a != "?") && (t != "?"))
  43. {
  44. // Missing U
  45. }
  46. else if ((v != "?") && (u != "?") && (a == "?") && (t != "?"))
  47. {
  48. // Missing A
  49. }
  50. else if ((v != "?") && (u != "?") && (a != "?") && (t == "?"))
  51. {
  52. // Missing T
  53. }
  54. else
  55. {
  56. return 0;
  57. }
  58.  
  59. }
  60.  
  61. int _tmain(int argc, _TCHAR* argv[])
  62. {
  63. string s, u, v, a, t;
  64. cout << "Enter a value for each factor, and enter '?' if unknown." << nl << nl;
  65. cout << "s: ";
  66. cin >> s;
  67. cout << nl << "u: ";
  68. cin >> u;
  69. cout << nl << "v: ";
  70. cin >> v;
  71. cout << nl << "a: ";
  72. cin >> a;
  73. cout << nl << "t: ";
  74. cin >> t;
  75. if (((v == "?") && (u != "?") && (a != "?") && (t != "?")) || ((v != "?") && (u == "?") && (a != "?") && (t != "?")) || ((v != "?") && (u != "?") && (a == "?") && (t != "?")) || ((v != "?") && (u != "?") && (a != "?") && (t == "?")))
  76. {
  77. cout << vuat(v, u, a, t);
  78. }
  79. else
  80. {
  81. cout << "Cock";
  82. }
  83. //vuat(v, u, a, t);
  84. system("PAUSE");
  85. return 0;
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement