Do I have the correct code?
It compiles and runs but I'm new to this and I'm just making sure.
Code:
#include<iostream>
#include<iomanip>
#include<stdlib.h>
using namespace std;
// prototype goes here
double calcint(double amount, double rate);
int year;
double rate;
double amount;
double annInt;
int main()
{
// declare variables
annInt = amount * rate * 1;
// get user input
cout << "Enter loan amount: ";
cin >> amount;
cout << "Enter loan rate: ";
cin >> rate;
// call function for calculation
annInt = calcint(amount, rate);
cout << "This is your annual intrest rate: " << annInt << endl;
// display results
system("pause");
return 0;
}
double calcint(double amount, double rate)
{
return amount * rate * 1;
}