Title | CSC 270 Labs 4-12 - Lab projects from 4 to 12 done in C++ with hand calculations included. |
---|---|
Author | Bryan Gomez |
Course | Introduction To Scientific Computing |
Institution | College of Staten Island CUNY |
Pages | 20 |
File Size | 385.8 KB |
File Type | |
Total Downloads | 104 |
Total Views | 141 |
Lab projects from 4 to 12 done in C++ with hand calculations included. ...
/*Bryan Gomez, Lab#4, 02/24/2020 This program will solve an electrostatic problem. The force, F between a small charged, Q, Sphere and a point test charge q separated by a distance, r , has been measured to be 0.5 Newtons. The Voltage, V, at a distance, r, from the small Sphere. The electric field, E, at the distance r from the small sphere. The Electric field, E2, half way between the two charges This program will calculate the distance between them , r for known F and then V, E and E2 */ #include #include #include using namespace std; const double k = 9e9; int main() { //Declare and initialize objects and units double F, Q, q, r, V, E, E2; string unit_of_r("Meters"); string unit_of_V("Newton-Meter/Coulomb"); string unit_of_E("Newton/Coulomb"); string unit_of_E2("Newton/Coulomb"); //Print directions for user to input variables cout Q >> q >> F; //Compute the distance of the two charges r = sqrt(k * ((Q * q) / F)); //Print the distance between the charges cout...