Visual C++ errors and switch statement

Hello,

I am a beginner c++ programmer that is just taking it slow and learning concepts, syntax, and rules. I am working on a Mortgage calculator that runs fine except for the switch statement at the end of the program automatically closes when the user enters the choice also, there are some .dll errors in the Visual C++ console.

Visual c++ errors:
'Mortgage Calculator.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'Mortgage Calculator.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'Mortgage Calculator.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'Mortgage Calculator.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file

Source code:

#include <iostream>
#include <string>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>


using namespace std;

//Declaring user input variable
long int price_of_home;
float Amountofint;
float userBankint;

int main(void)
{
bool end = false; //To end the program when the user quits
float interestRmonthly; // Interest Rate monthly
double userMfinal; // Final/Total Mortgage amount for the user.
double pricemonthly; //Price of home monthly

//Declaring user input variable
long int price_of_home;
float Amountofint;
float userBankint;


//Asking user for name. Just to personalize their experience.
string userN;
cout << "Welcome to my mortgage calculator! What is your name? \n\n";
cin >> userN;
cout << "Hello! " << userN << " Let's get started on calculating your monthly "
<< "mortgate costs. \n " << endl;

//Finding out price of home
cout << " First, how much does your home costs?";
cin >> price_of_home;
cin.ignore();
cout << "\n";

//Calculate user interest by converting percentage into deciamal
cout << "Now, what is the interest rate?" << endl;
cin>> userBankint;
userBankint = userBankint/100;
cout << "\n";

cout << "The total price of your home is " << price_of_home << " and the interest rate given is " << userBankint << endl;
cout << "\n";

//Multiply amount price of home and interest
Amountofint = (price_of_home * userBankint)/100;
cout << "When you multiply " << price_of_home << " with " << userBankint << " it comes out to " << Amountofint << endl;
cout << "\n";

//Monthly interest rate
cout << "Now to calculate the aproximate monthly interest for "
<< "the 360 months (30 years) " << endl << "of your loan........." << endl;
interestRmonthly = Amountofint/360;
cout << "\n";
cout << "The aproximate monthly interest is: " << interestRmonthly << "\n";


//Monthly cost of home
pricemonthly= (price_of_home/360);
cout << "The cost of the home monthly excluding interest is: " << pricemonthly << endl;

//Total cost
cout << "Now for the finale :)" << endl;
userMfinal = (pricemonthly + interestRmonthly);
cout << "The total aproximate price of your home including interest is about: " << userMfinal;
cout << "\n\n";

//Choosing the proper bank
cout << "Now time to choose your bank. " << "\n";
cout << "Choosing between number 1 - 5!," << endl
<<"Please choose the corresponding number for your bank "<< endl;
cout << "\n\n";
cout << "Bank of America is [1]" << endl;
cout << "Grow Financial is [2]" << endl;
cout << "Chase is [3] "<< endl;
cout << "Fifth 3rd is [4]" << endl;
cout << "Citi Bank is [5]" << endl;

//Menu for choosing which bank (out of 5)
int bankchoice = 0;

cout << "Choice: " ;
cin >> bankchoice;
cin.ignore();

if(bankchoice >= 6)
cout << "Invalid choice made";



//Start of program loop
switch(bankchoice)
{
case 1:
cout << "Bank of America's interest rate of " <<userBankint << " calculated with the home price of: " << price_of_home << endl;
cout << "Comes out to an aproximate total of: " << userMfinal;
break;

case 2:
cout << "Grow Financial's interest rate of " <<userBankint <<" calculated with the home price of: " << price_of_home << endl;
cout << "Comes out to an aproximate total of: " << userMfinal;
break;
case 3:
cout << "Chase Bank's interest rate of "<<userBankint << " calculated with the home price of: " << price_of_home << endl;
cout << "Comes out to an aproximate total of: " << userMfinal;
break;
case 4:
cout << "Fifth 3rd Bank's interest rate of "<<userBankint << " calculated with the home price of: " << price_of_home << endl;
cout << "Comes out to an aproximate total of: " << userMfinal;
break;
case 5:
cout << "Citi Bank's interest rate of "<< userBankint << " calculated with the home price of: " << price_of_home << endl;
cout << "Comes out to an aproximate total of: " << userMfinal;
break;

return 0;

}


cin.sync();
return 0;
}

Is there anything I have done wrong? in the sense of the switch statement for it to close automatically? Sorry if I am not descriptive enough I do not know what else to provide.
closed account (o3hC5Di1)
Hi there,

Have a look at this thread: http://cplusplus.com/forum/beginner/1988/
The program to close is very common (on windows), so they made a sticky for it.
You'll find all kinds of ways to prevent that there, just stay away from system().

All the best,
NwN
Thanks for the help appreciate it.
Topic archived. No new replies allowed.