0
Can someone help me with this C++ problem
so the question goes like this; One acre of land is equivalent to 43,560 square feet. Write a program that calculates the number of acres in a tract of land with 389,767 square feet. my answer: float tractLand = 389767; float oneAcre = 43560; float tractLandAcred = tractLand / oneAcre; cout << tractLand << " square feet is equal to " << tractLandAcred << " acres." << endl; Now its wrong because I displayed "389767 square feet is equal to 8.94782 acres." and it wanted "389,767sf equals 8.94782 acres. Why?
1 Answer
+ 9
You might want to look into formatting the output using iomanip.
See:
https://www.cprogramming.com/tutorial/iomanip.html
Also you can insert commas using one of the methods listed here.
https://stackoverflow.com/questions/7276826/c-format-number-with-commas