Search
 
SCRIPT & CODE EXAMPLE
 

CPP

yearly interest calculator c++ using for loop

#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

void main()
{
// Inputs //

double princ = 0.0;
double rate = 0.0;
int years = 0;
int year = 1;
double total = 0.0;

// Ask User For INFO //

cout << "What is the principle? ";
cin >> princ;
cout << "What is the rate in decimal? ";
cin >> rate;
cout << "how many years? ";
cin >> years;



for (double total; total = princ*(1+rate)*year;)
{
cout << "The balance after year " << year << " is "<< total << endl << endl;
year += 1;
}

while((years + 1)!= year);

system("pause");
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ static array in Klasse 
Cpp :: how to delay text in c++ console app 
Cpp :: Int main ( ) { int i,n; cinn; i=n; while(i=1) { i=i+5; i=i-6; } } 
Cpp :: minimum no of jump required to reach end of arry 
Cpp :: vector of vector definaion in c++ 
Cpp :: random 1 diem tren man hinh bang dev c 
Cpp :: C++ Ranged Based for Loop 
Cpp :: c++ format number thousands separator 
Cpp :: string class cpp 
Cpp :: vector.rbegin() 
Cpp :: Swift if...else Statement 
Cpp :: Change Font ImGui 
Cpp :: what is a string called in c++ 
Cpp :: cicli informatica c++ 
Cpp :: remove element from vector c++ by index 
Cpp :: executing linux scripts 
Cpp :: min stack 
Cpp :: c++ is nan 
Cpp :: C++ area & circumference of a circle 
Cpp :: convert from hex to decimal c++ 
Cpp :: Arduino Counting 
Cpp :: c++ error 0xC0000005 
C :: boilerplate c 
C :: rename c 
C :: c get time 
C :: execution time of c program 
C :: random number c 
C :: operators priority in c 
C :: unity set transform position code 
C :: c argv 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =