Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- struct Resistor
- {
- double Rnominal, Ractual, tol;
- }
- void setActual(Resistor&);
- int main()
- {
- Resistor r1(330);
- setActual(r1);
- cout << r1 << endl;
- }
- void setActual(Resistor& r)
- {
- double ranNum1, ranNum2;
- ranNum1 = static_cast<double>(rand()) / RAND_MAX * r + (r * 0.05);
- ranNum2 = static_cast<double>(rand()) / RAND_MAX * r - (r * 0.05);
- cout << ranNum1 << endl << ranNum2 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement