Anti-electric universe

October 24, 2017

Some c++ code

Filed under: Uncategorized — davidlpf @ 9:38 am

#include
#include

using namespace std;

int main()
{
float parsec;
float distance;
float apparentmagnitude;
float absolutemagnitude;
float Flux;
float luminosity;
float radius;
int number,anglestar2;
int number2,number3;
float Fluxten;
float lightyears;
float dinmeters;
float lightyear;
float distance1;
float distance2;
float distance3;
float ForceG;
float mass1;
float mass2;
float radius1;
float G;
float k;
float radius2;
float charge1;
float charge2;
float ForceE;
float Dtstar,diametertelescope,res;
float Dostar,planetmass,testmass,ForceP,ForceH,Comparef,wavelength;
float anglstar, accPlanet, PlanetG,planetdiameter,planetradius;

k=8.988e9;
G=6.67e-11;
cout<< "Do you want to find the:" << endl;
cout<< "1.Distance"<<endl;
cout<< "2.Flux"<<endl;
cout <<"3: Convert to light years from parsecs"<<endl;
cout << "4.Convert from light years to moeters"<<endl;
cout <<"5. Convert from parsec to meters"<<endl;
cout << "6.The force due to Gravity"<<endl;
cout << "7.The force due to electrical charge"<<endl;
cout << "8. Find the angualar size of an object"<<endl;
cout << "9. The size of the object in meters using angualr size and distance "<<endl;
cout << "10. Do you want to find the gravitational force on a differnt planet"<<endl;
cout << "11. to find the resolution of a telescope"<> number;
if(number==1)
{

cout<< "1.Do you know the measurement of parallex seconds "<<' '<< endl;
cout << "2. Do you know the Flux of the star"<< endl;
cout << "3. Do you know the absolute and apparent magnitudes "<>number2;
if(number2==1)
{
cout<< "please enter the seconds of arc"<>parsec;
distance=1/parsec;
cout <<"the distance is"<<' '<<distance<<' '<<"parsecs"<<endl;
}
if(number2==2)
{
cout<< "please enter the measured flux of the star measured from where it is"<>Flux;
cout<<"Please enter the flux from 10 Parsecs"<> Fluxten;
distance1=(Fluxten/Flux)*100;
cout << "the distance to the Star is"<<distance1<< ' '<<"pc"<<endl;
}
if(number2==3)
{
cout<<"Enter the Apparent magnitude."<> apparentmagnitude;
cout<< "Enter the absolute magnitude."<> absolutemagnitude;
distance3= pow(10,((apparentmagnitude-absolutemagnitude)+5)/5);
cout<< "the distance is"<< ' ' << distance3<< ' '<<"pc"<< endl;
}
}
if(number==2)
{
cout<< "Do you now the Luminosity of the Star"<>luminosity;
cout <<"Do Know the distance from the star to where was measured"<>radius;
Flux=luminosity/(4*3.14*(radius*radius));
cout<< "the Flux is"<<' '<< Flux<< ' ' << "W/M"<< endl;
}
if(number==3)
{
cout<< "please enter the distance in parsecs"<> distance2;
lightyear=distance2*3.26;
cout<< "The distance in light years is"<< ' ' <<lightyear<<endl;
}
if(number==4)
{
cout << "Please enter the distance lightyears"<> lightyear;
dinmeters=lightyear*9.461e15;
cout<< "The distance in meters"<<dinmeters<<"m"<<endl;
}
if(number==5)
{
cout << "Please enter the distance in parsecs"<> parsec;
dinmeters=parsec*3.26*9.461e15;
cout<< "The distance in meters is" <<dinmeters<<"m" <<endl;
}
if(number==6)
{
cout << "Please enter the distance between the two objects"<> radius1;
cout << "Enter the mass of the larger object"<>mass1;
cout << "Enter the mass of the smaller object"<> mass2;
ForceG=G*mass1*mass2/(radius1*radius1);
cout << "The force due to gravity"<< ' ' <<ForceG<<"N"<<endl;
}
if(number==7)
{
cout << "Please enter the distance between the two objects"<>radius2;
cout << "please enter ther charge on the first object"<> charge1;
cout << "Please enter the charge on the second particle"<> charge2;
ForceE=k*charge1*charge2/(radius2*radius2);
cout << "The force from the coulomb force is"<< ForceE<< ' ' << "N"<<endl;
}
if (number==8)
{
cout << "please enter the distace to object"<> Dtstar;
cout << "Please enter the diameter of the object"<>Dostar;
anglstar=atan(Dostar/Dtstar)*(180/M_PI);
cout << "do you want expressed in degrees(1), arc min(2) or arc sec(3)"<> anglestar2;
if (anglestar2==1)
{
cout << " the size of the object is"<<anglstar<<' ' <<"degress"<<endl;
}
if (anglestar2==2)
{
anglstar=anglstar*60;
cout<< "the size of the object is"<< anglstar<< ' '<<" minutes of arc"<<endl;
}
if (anglestar2==3)
{
anglstar=anglstar*3600;
cout <<"the size of the object is"<< anglstar<< ' '<<" arc sec"<<endl;
}

}
if (number==9)
{

cout << "Please enter the diameter to object in m"<> Dtstar ;
cout << "Please enter the anglular size of the star"<> anglstar;
Dostar=Dtstar*anglstar;
cout << "The star is"<< ' ' << Dostar<< ' '<< "meters away"<< endl;
}
if (number==10)
{
cout<< "What is the diameter of the planet"<> planetdiameter;
planetradius=planetdiameter/2;
cout << "Please enter the mass of the planet"<> planetmass;
accPlanet=G*planetmass/(planetradius*planetradius);
cout<< "please enter the mass you want to use"<> testmass;
PlanetG=testmass*accPlanet;
cout << " The force due to gravity is"<< PlanetG<< ' '<<"N"<<endl;

cout << " Let us compare the planet gravitational force compared to the Earth"<<endl;

Comparef=accPlanet/9.8;
cout<< " the differnce in gravity is"<< ' '<<Comparef<< ' ' <<"that of Earth"<<endl;
}
if(number==11)
{

cout << "pleaee enter the diameter of telescope"<> diametertelescope;
cout <<"please enter the wavelenghth that you are observing"<> wavelength;
res=1.22*(wavelength/diametertelescope)*(180/M_PI);
cout << "do want the resolution in degress(1), Arc min(2), or arc sec(3)"<> number3;
if (number3==1)
{
cout<< " the resolution of the telescope is"<< res<< ' '<< "degrees"<<endl;
}
if (number3==2)
{
res=res*60;
cout <<" the resolution of the telescope"<< res <<' '<<"arc min"<<endl;
}
if(number3==3)
{
res=res*3600;
cout << "the resolution of telescope is "<< res<< ' '<<"arc sec"<<endl;
}
}

return 0;

}

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: