whats wrong with my program!!!!???

my program keeps exiting in the middle; and i am not sure what i did wrong. This is the program:
#include<iostream>
#include<string>
#include<cmath>

using namespace std;

const double e = 2.718281821459045;
double computeTotal;
double p, r, t, total;
double x,y;
int unknown = 0;
string compound;


int main(){

	cout<< "Hello, this program is designed to compute interest!"<<endl;
	cout<< "Let's get started!"<<endl<<endl<<endl;
	cout<< "Enter an amount for each of the following; ";
	cout<< "if amount it unknown, type 'unknown'"<<endl;
	cout<<"#1---Please enter your inital balance: ";
	cin>>p;
	cout<<endl;
	cout<<"#2---Please enter the interest rate: ";
	cin>>r;
	cout<<endl;
	cout<<"#3---Please enter the number of years invested: ";
	cin>>t;
	cout<<endl;
	cout<<"#4---Please enter the total amount after that number of years: ";
	cin>>total;
	cout<<endl<<endl;
	cout<<"Would you like for it to be compounded continuously or compounded monthly?"<<endl;
	cout<<"Enter 'continuously' or 'monthly': ";
	cin>>compound;
	cout<<endl<<endl;

	 
	if (compound=="monthly"||compound=="Monthly"){
		if (p==0){
			p = total/ pow(pow((1+(r/12)),12),t);
			cout<<"Your intital balance is: "<<p<<endl;
			cout<<"***Summmary of Information***"<<endl;
			cout<<"Initial Balance: "<<p<<endl;
			cout<<"Interest Rate: "<<r<<endl;
			cout<<"Number of Years Invested: "<<t<<endl;
			cout<<"Total Amount After That Number of Years: "<<total<<endl;
			cout<<"Compounded: "<<compound<<endl;
		}
		else if (r==0){
			r= pow((total/p),(1.0/(12*t)));
			cout<<"Your interest rate is: "<<r<<endl;
			cout<<"***Summmary of Information***"<<endl;
			cout<<"Initial Balance: "<<p<<endl;
			cout<<"Interest Rate: "<<r<<endl;
			cout<<"Number of Years Invested: "<<t<<endl;
			cout<<"Total Amount After That Number of Years: "<<total<<endl;
			cout<<"Compounded: "<<compound<<endl;	 

		}
		else if (t==0){
			y = log(total/p)/log(1+(r/12));
			t= y/12;
			cout<<"The total amount after that number of years is: "<<t<<endl;
			cout<<"***Summmary of Information***"<<endl;
			cout<<"Initial Balance: "<<p<<endl;
			cout<<"Interest Rate: "<<r<<endl;
			cout<<"Number of Years Invested: "<<t<<endl;
			cout<<"Total Amount After That Number of Years: "<<total<<endl;
			cout<<"Compounded: "<<compound<<endl;

			
		}
		else if (total==0){
			total = p * pow(pow((1 + (r/12)),12),t);
			cout<<"Your total amount after that number of years is : "<<total<<endl<<endl;
			cout<<"***Summmary of Information***"<<endl;
			cout<<"Initial Balance: "<<p<<endl;
			cout<<"Interest Rate: "<<r<<endl;
			cout<<"Number of Years Invested: "<<t<<endl;
			cout<<"Total Amount After That Number of Years: "<<total<<endl;
			cout<<"Compounded: "<<compound<<endl;
		}




	}
	else if (compound=="continuously"||compound=="Continuously") {
		if (p==0){
			p = total/pow(pow(e,r),t);
			cout<< "Your initial balance is : "<<p<<endl<<endl;
			cout<<"***Summmary of Information***"<<endl;
			cout<<"Initial Balance: "<<p<<endl;
			cout<<"Interest Rate: "<<r<<endl;
			cout<<"Number of Years Invested: "<<t<<endl;
			cout<<"Total Amount After That Number of Years: "<<total<<endl;
			cout<<"Compounded: "<<compound<<endl;
		}
		else if (r==0){
			x =log(total/p);
			r = x/t;
			cout<<"Your interest rate is: "<<r<<endl;
			cout<<"***Summmary of Information***"<<endl;
			cout<<"Initial Balance: "<<p<<endl;
			cout<<"Interest Rate: "<<r<<endl;
			cout<<"Number of Years Invested: "<<t<<endl;
			cout<<"Total Amount After That Number of Years: "<<total<<endl;
			cout<<"Compounded: "<<compound<<endl;	 
		}
		else if (t==0){
			x= log(total/p);
			t= x/r;
			cout<<"The total amount after that number of years is: "<<t<<endl;
			cout<<"***Summmary of Information***"<<endl;
			cout<<"Initial Balance: "<<p<<endl;
			cout<<"Interest Rate: "<<r<<endl;
			cout<<"Number of Years Invested: "<<t<<endl;
			cout<<"Total Amount After That Number of Years: "<<total<<endl;
			cout<<"Compounded: "<<compound<<endl;
		}
		else if (total==0){
			total = p * pow(pow(e,r),t);
			cout<<"Your total amount after that number of years is : "<<total<<endl<<endl;
			cout<<"***Summmary of Information***"<<endl;
			cout<<"Initial Balance: "<<p<<endl;
			cout<<"Interest Rate: "<<r<<endl;
			cout<<"Number of Years Invested: "<<t<<endl;
			cout<<"Total Amount After That Number of Years: "<<total<<endl;
			cout<<"Compounded: "<<compound<<endl;
		}
	}
	else{
		cout<<"You have not followed intructions; your answer has caused the program to fail !!!"<<endl;
		cout<<"Hit enter to exit the screen."<<endl;
		 
	}





cout<<endl;
return 0;
}






help! whats wrong?
You are attempting to store string 'unknown' into variables of type double, at least that's what i get, hope it helps :)
Topic archived. No new replies allowed.