Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include <sstream>
- using namespace std;
- const double pi = 3.1415926535;
- const string nl = "\n";
- //void ConvertToDoubles()
- //{
- // if (v == "?")
- // {
- //
- // }
- // else
- // {
- //
- // }
- //}
- double vuat(string v, string u, string a, string t)
- {
- double result;
- if ((v == "?") && (u != "?") && (a != "?") && (t != "?"))
- {
- // Missing V
- u.ToDoubl
- double newU, newA, newT;
- stringstream convert(u);
- convert >> newU;
- stringstream convert(a);
- convert >> newA;
- stringstream convert(t);
- convert >> newT;
- result = newU + (newA * newT);
- return result;
- }
- else if ((v != "?") && (u == "?") && (a != "?") && (t != "?"))
- {
- // Missing U
- }
- else if ((v != "?") && (u != "?") && (a == "?") && (t != "?"))
- {
- // Missing A
- }
- else if ((v != "?") && (u != "?") && (a != "?") && (t == "?"))
- {
- // Missing T
- }
- else
- {
- return 0;
- }
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- string s, u, v, a, t;
- cout << "Enter a value for each factor, and enter '?' if unknown." << nl << nl;
- cout << "s: ";
- cin >> s;
- cout << nl << "u: ";
- cin >> u;
- cout << nl << "v: ";
- cin >> v;
- cout << nl << "a: ";
- cin >> a;
- cout << nl << "t: ";
- cin >> t;
- if (((v == "?") && (u != "?") && (a != "?") && (t != "?")) || ((v != "?") && (u == "?") && (a != "?") && (t != "?")) || ((v != "?") && (u != "?") && (a == "?") && (t != "?")) || ((v != "?") && (u != "?") && (a != "?") && (t == "?")))
- {
- cout << vuat(v, u, a, t);
- }
- else
- {
- cout << "Cock";
- }
- //vuat(v, u, a, t);
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement