MaverickSawyer
Acolyte of the Probe
Lately, I have been learning how to code in C++. It's actually quite similar to the forma used by my TI-89 graphing calculator, so I have a fairly good understanding, which I was quite suprised by. Anyway, I have a program on the TI that can determine the elements of a circular orbit around a variety of bodies in our system from just one input, which can be altitude, period, or velocity. I am working on converting it to C++, but it's slow.
Anyways, this is what I have so far, without any test runs for stability:
Am I on a good track, or am I going the wrong way?
Comments and criticisms are invited.
Anyways, this is what I have so far, without any test runs for stability:
Code:
#include <iostream>
using namespace std;
int main()
{
int type;
cout << "Select Known Value: ";
cout << "1: Altitude";
cout << "2: Period";
cout << "3: Velocity";
cout << "Choice: ";
cin >> type;
cout << "You chose: " << type << "." << endl;
if (type==1);
{
int refob;
int alt;
int rad;
int orad;
int mass;
int time;
cout << "Select Reference Object: ";
cin >> refob;
cout << "Chosen Reference: " << refob << "." << endl;
cout << "Enter Altitude in meters: ";
cin >> alt;
cout << "Your altitude is " << alt << " meters." << endl;
}
else if (type==2);
{
int refob;
int time;
int orad;
int rad;
int alt;
int vel;
cout << "Select Reference Object: ";
cin >> refob;
cout << "Chosen Reference: " << refob << "." << endl;
cout << "Enter Orbital period in seconds: ";
cin >> time;
cout << "Your orbital period is " << time << " seconds." << endl;
}
else if (type==3);
{
int refob;
int vel;
int orad;
int rad;
int alt;
int time;
cout << "Select Reference Object: ";
cin >> refob;
cout << "Chosen Reference: " << refob << "." << endl;
cout << "Enter Orbital velocity in meters per second :";
cin >> vel;
cout << "Your orbital velocity is " << vel << " meters per second." << endl;
}
else
{
cout << "ERROR: Invalid Entry!" << endl;
}
return 0;
}
Am I on a good track, or am I going the wrong way?
Comments and criticisms are invited.