Hi I'm sorry if this seem quite lame because for me it is as well
I'm currently writing a program using Microsoft Visual 6 C++
my program is as such
this program of mine will loop endlessly if the value is 1000, but if the value is 100 it will provide me with the proper answer please help me out.Code://This program is used to loop a number untill the value is found. #include <iostream> #include <iomanip> using namespace std; void main() { float value; value = 1000; int number; number = 0; float interest; cout.setf(ios::fixed); cout.precision(2); float totalInterest; totalInterest = 0; float amount; amount = 50; while (value > 0) { interest = value * 0.15; amount -= interest; value -= amount; totalInterest = totalInterest + interest; number++; cout<<"The amount of times this process is repeated is "<<number<<endl; cout<<"The total amount of the interest is "<<totalInterest<<endl; cout<<"The amount left is "<<value<<endl; } }
P.S. I havent sleep in days thanks to this problem please help![]()



LinkBack URL
About LinkBacks




