using namespace std;
int main()
{
cout << "Loan Interest Calculator" << endl; //prompted when opened//
char Letters;
double Amount;
double rate;
double years;
cout << "Would You Like To Continue? [Y] Yes, [N] No." << endl;
cin >> Letters;
cout << "How Much Is it originally: $";
cin >> Amount;
cout << "Rate, Example (3.56) ";
cin >> rate;
cout << "How Many Years, If including months find the decimal of months out of the year" << endl;
cin >> years;
double total = Amount * rate * years;
cout << "Total Payment(WITH INTEREST): $" << total << endl;
system("pause");
return 0;
}```
#Y/N to continue
1 messages · Page 1 of 1 (latest)
whats the question
I waNt it so whenever I type in Y it continues.
if N it leaves.
very confused on that.
have you considered comparing the input to y and n
i don't know how to do that, yesterday i learned the basics of c++
I know a little bit.
i've made a few programs.
no, but I did another program that includes that.
you should learn those before writing anything
because those are essential to programming itself
if (condition)
{
//code if condition is true
}
else
{
//code if condition is not true
}
makes sense.
how would i get the keybind function.
I am pretty sure i have to include something right?
keybinds?
Oh.
you just need to compare it Y or N
Also not just if and else, theres a lot of structures you need to learn like
While loops
For Loops
you should learn structs and classes as well
You need to learn more because these are really important for doing basic things
also for operators: *, ==, &&, ||
I recommend learncpp or just looking at documentation
yes
alright, thanks for taking your time to help a newbie😁
np
Also.
How would I exit the program if the keybind y isn't detected.
so if they press z'
or n
it'll just close
exit()?
exit(0);
it can be anything
oh alright.
but 0 is generally used for exit success
alright.
dude
I just wanna say thanks to you.
without you i would of been going through 10 million forums getting nothing.
it works!
if u do any other keybind it just exits
to be honest, this is really basic stuff. If you knew the basics you wouldn't have had to ask so please learn more about programming in general before writing programs.
alright.
I recommend this tutorial https://www.w3schools.com/cpp/default.asp