This has only one function to solve projectile motion, but it doesnt seem like it works, why?

//Richard Chaaya
//1-25-09
//kinimatics

#include <iostream>
#include <conio.h>
#include <iomanip>
#include <string>

using namespace std;

int main()
{ 
//declare variables
double dblVix = 0.0;
double dblViy = 0.0;
double dblVfx= 0.0;
double dblVfy= 0.0;
double dblAx= 0.0;
double dblAy= 0.0; 
double dblTime= 0.0;
double dblDisx= 0.0;
double dblDisy= 0.0;
double Disx= 0.0;
double Disy= 0.0;
double dblDifference1 =0.0;
char charAsk;
char charDisx='y';
char charTime='y';
char charVfx=' ';
char charVix=' ';
char charAx=' ';
char charAy=' ';
char chartime= ' ';
char charViy= ' ';
char chrDisx=' ';
char charDisy= ' ';
char chrVfx=' ';
char chrTime=' ';
char chrVfy= ' ';
char chrDisy= ' ';
//Prototypes:
double Ax (double, double, double, double, double, char, char, char);
double Ay (double, double, double, double, double, char, char, char);

//enter input
cout << "hello, and welcome. This program is useful for projectile motion,  it prompts you to enter the givens and the unknowns, and it outputs the answer ";
cout << "\n\n Is Vi in the x given ?" <<endl;
cin >> charVix;
if(charVix=='Y' || charVix=='y')
{cout << "what is the Initial velocity in the x?" <<endl;
cin >> dblVix;}
cout << "\n\n Is Vi in the y given ?" <<endl;
cin >> charViy;
if(charViy=='Y' || charViy=='y')
{cout << "what is the Initial velocity in the y?" <<endl;
cin >> dblViy;}
cout << "\n\n Is A in the x given ?" <<endl;
cin >> charAx;
if(charAx=='Y' || charAx=='y')
{cout << "what is the acceleration in the x?" <<endl;
cin >> dblAx;}
cout << "\n\n Is A in the y given ?" <<endl;
cin >> charAy;
if(charAy=='Y' || charAy=='y')
{cout << "what is the Initial velocity in the x?" <<endl;
cin >> dblAy;}
cout << "\n\n Is Time given ?" <<endl;
cin >> charTime;
if(charTime=='Y' || charTime=='y')
{cout << "what is the time (delta t)?" <<endl;
cin >>dblTime;}
cout << "\n\n Is the Displacement in the x given ?" <<endl;
cin >> charDisx; 
if(charDisx=='Y' || charDisx=='y')
{cout << "what is the displacement in the x?" <<endl;
cin >> dblDisx;}
cout << "\n\n Is the Displacement in the y given ?" <<endl;
cin >> charDisy;
if(charDisy=='Y' || charDisy=='y')
{cout << "what is the Displacement in the y?" <<endl;
cin >> dblDisy;}



if(charAx=='Y' || charAx=='y')
{
	dblAx=Ax(dblVix, dblVfx, dblTime, dblAx, dblDisx,  chrDisx,  chrTime,  chrVfx);
};

cout <<dblAx;
cout << " The acceleration in the x is" << dblAx;



if(charAy=='Y' || charAy=='y')
{
	dblAy=Ay(dblViy, dblVfy, dblTime, dblAy, dblDisy,  chrDisy,  chrTime,  chrVfy);
}; 

cout << dblAy;

cout << " The acceleration in the y is" << dblAy;


 _getch(); 
     ; 
}








// This function solves for acceleration in the X direction. 
double Ax(double dblVix, double dblVfx, double dblTime, double dblAx, double dblDisx, char chrDisx, char chrTime, char chrVfx)
{
	
	//define local varibles
	int intFunc = 0;

	//calculate
	if(toupper(chrDisx) != 'Y')//they dont have dblDisX
		intFunc = 1;
	if(toupper(chrTime) != 'Y')//they dont have dblTime
		intFunc = 2;
	if(toupper(chrVfx) != 'Y')//they dont have dblVfx
		intFunc = 3;

	switch (intFunc)
	{	
	case 1:
		 dblAx=(dblVfx - dblVix)/ dblTime ;
		break;

	case 2:
		 dblAx=(dblVfx*dblVfx - dblVix*dblVix)/(2*dblDisx);
		break;

	case 3:
		dblAx= 2*(dblDisx - dblVix*dblTime)/(dblTime*dblTime) ;
		break;
	default:
		cout << "error";
		break;
	}
	return dblAx;
}
double Ay(double dblViy, double dblVfy, double dblTime, double dblAy, double dblDisy, char chrDisy, char chrTime, char chrVfy)
{
	
	//define local varibles
	int intFunc = 0;

	//calculate
	if(toupper(chrDisy) != 'Y')//they dont have dblDisy
		intFunc = 1;
	if(toupper(chrTime) != 'Y')//they dont have dblTime
		intFunc = 2;
	if(toupper(chrVfy) != 'Y')//they dont have dblVfy
		intFunc = 3;

	switch (intFunc)
	{	
	case 1:
		 dblAy=(dblVfy - dblViy)/ dblTime ;
		break;

	case 2:
		dblAy=(dblVfy*dblVfy - dblViy*dblViy)/(2*dblDisy) ;
		break;

	case 3:
		dblAy=2*(dblDisy - dblViy*dblTime)/(dblTime*dblTime) ;
		break;
	default:
		cout << "error";
		break;
	}
	return dblAy;
}
Comments
Failed to use code tags
This question has already been answered. Start a new discussion instead.