-
4 easy question
1# I am using a double. When I cout out my data I want there to be two digits after the period. How do I do this? Example 2+3 = 5.00 instead of 5.
2# When I use tabs (the ones on your keyboards) it works like regular tabs (as it would in MS word, or notepad). When you hit tab it moves the cursor to a certain location and everything you type is added and it expends to the right. How do I make it to expand to the left? (for example, tell ms word to align everything to the right, when you add text, its pushed to the left to make room.) I need this info simple to make my program look better.
3# What is the best and easy way to erase the whole screen (so I can output the data to a clean screen).
4# I am trying to calculate balance in a savings account... But the problem is the formulate is
AmountInSavings = Principle * ((1 + (InterestRate/TimesCompounded)) ^ TimesCompounded)
The problem there is the fact that you can not scare root double numbers (and InterestedRate is a fraction).
-
To your first question look up 'setprecision'.
Use 'std::fill' for your second.
Look in the FAQ
I didn't know doubles could be scared! :p
-
1)
Code:
#include <iomanip>
...
...
cout<<fixed<<setprecison(2)<<your_var;
2) and 3) See here:
http://www.adrianxw.dk/SoftwareSite/...Consoles1.html
If you want to keep 3) simple, you can do this:
Code:
for(int i=0; i<100; i++)
cout<<endl;
4) Huh?
double pow( double base, double exp );